Skip to content

Commit

Permalink
Merge pull request #17 from wetware/bugfix/nonblocking-sub-handler
Browse files Browse the repository at this point in the history
Fix rpc.Conn disconnect when subscription buffer is full
  • Loading branch information
aratz-lasa authored Apr 22, 2022
2 parents 60f4561 + 8fa954a commit ff2b530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions pkg/cap/cluster/anchor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import (

func TestAnchor(t *testing.T) {
t.Parallel()
t.Helper()

t.Skip("TODO: finish implementing anchor refcounting")

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
Expand Down
9 changes: 4 additions & 5 deletions pkg/cap/pubsub/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,16 @@ func (h handler) Shutdown() {
h.release()
}

func (h handler) Handle(ctx context.Context, call api.Topic_Handler_handle) error {
func (h handler) Handle(_ context.Context, call api.Topic_Handler_handle) error {
b, err := call.Args().Msg()
if err != nil {
return err
}

select {
case h.ms <- b:
return nil

case <-ctx.Done():
return ctx.Err()
default:
}

return nil
}

0 comments on commit ff2b530

Please sign in to comment.