-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hide Watch method from Client.go and move into Attach method #593
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,7 @@ func NewSubscription(subscriber *time.ActorID) *Subscription { | |
return &Subscription{ | ||
id: xid.New().String(), | ||
subscriber: subscriber, | ||
events: make(chan DocEvent, 1), | ||
events: make(chan DocEvent, 3), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same here. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -179,7 +179,7 @@ func BenchmarkRPC(b *testing.B) { | |
assert.NoError(b, err) | ||
|
||
d1 := document.New("doc1") | ||
err = cli.Attach(ctx, d1) | ||
_, err = cli.Attach(ctx, d1) | ||
assert.NoError(b, err) | ||
|
||
for i := 0; i < b.N; i++ { | ||
|
@@ -202,8 +202,9 @@ func BenchmarkRPC(b *testing.B) { | |
ctx := context.Background() | ||
|
||
d1 := document.New(helper.TestDocKey(b)) | ||
err := c1.Attach(ctx, d1) | ||
rch1, err := c1.Attach(ctx, d1) | ||
assert.NoError(b, err) | ||
assert.NotNil(b, rch1) | ||
testKey1 := "testKey1" | ||
err = d1.Update(func(root *json.Object, p *presence.Presence) error { | ||
root.SetNewText(testKey1) | ||
|
@@ -212,7 +213,8 @@ func BenchmarkRPC(b *testing.B) { | |
assert.NoError(b, err) | ||
|
||
d2 := document.New(helper.TestDocKey(b)) | ||
err = c2.Attach(ctx, d2) | ||
rch2, err := c2.Attach(ctx, d2) | ||
assert.NotNil(b, rch2) | ||
assert.NoError(b, err) | ||
testKey2 := "testKey2" | ||
err = d2.Update(func(root *json.Object, p *presence.Presence) error { | ||
|
@@ -221,11 +223,6 @@ func BenchmarkRPC(b *testing.B) { | |
}) | ||
assert.NoError(b, err) | ||
|
||
rch1, err := c1.Watch(ctx, d1) | ||
assert.NoError(b, err) | ||
rch2, err := c2.Watch(ctx, d2) | ||
assert.NoError(b, err) | ||
|
||
done1 := make(chan bool) | ||
done2 := make(chan bool) | ||
|
||
|
@@ -286,13 +283,15 @@ func BenchmarkRPC(b *testing.B) { | |
wg.Add(2) | ||
go func() { | ||
defer wg.Done() | ||
err := c1.Attach(ctx, doc1) | ||
rch1, err := c1.Attach(ctx, doc1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it is necessary to receive and check Maybe setting If you think this suggestion is reasonable, please check other test codes changes that you have made to apply this suggestion. |
||
assert.NoError(b, err) | ||
assert.NotNil(b, rch1) | ||
}() | ||
go func() { | ||
defer wg.Done() | ||
err := c2.Attach(ctx, doc2) | ||
rch2, err := c2.Attach(ctx, doc2) | ||
assert.NoError(b, err) | ||
assert.NotNil(b, rch2) | ||
}() | ||
wg.Wait() | ||
}() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.