Browse Source

fixes after my own review (Refs #945)

pull/948/head
Anton Kaliaev 7 years ago
parent
commit
90cdffa067
No known key found for this signature in database GPG Key ID: 7B6881D965918214
2 changed files with 2 additions and 4 deletions
  1. +2
    -0
      rpc/client/httpclient.go
  2. +0
    -4
      rpc/core/events.go

+ 2
- 0
rpc/client/httpclient.go View File

@ -323,6 +323,8 @@ func (w *WSEvents) eventListener() {
w.Logger.Error("failed to unmarshal response", "err", err)
continue
}
// NOTE: writing also happens inside mutex so we can't close a channel in
// Unsubscribe/UnsubscribeAll.
w.mtx.RLock()
if ch, ok := w.subscriptions[result.Query]; ok {
ch <- result.Data


+ 0
- 4
rpc/core/events.go View File

@ -50,10 +50,6 @@ func Subscribe(wsCtx rpctypes.WSRPCContext, query string) (*ctypes.ResultSubscri
ctx, cancel := context.WithTimeout(context.Background(), subscribeTimeout)
defer cancel()
ch := make(chan interface{})
es := wsCtx.GetEventSubscriber()
if es == nil {
es = eventBus
}
err = eventBusFor(wsCtx).Subscribe(ctx, addr, q, ch)
if err != nil {
return nil, err


Loading…
Cancel
Save