rpcclient: send notificaitons processing to a separate routine

Pavel is struggling without it.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
This commit is contained in:
Anna Shaleva 2024-10-04 20:04:46 +03:00
parent c960a7eb47
commit 5e5e7d9482

View file

@ -96,6 +96,7 @@ type WSOptions struct {
// thus it's still the caller's duty to call Unsubscribe() for this // thus it's still the caller's duty to call Unsubscribe() for this
// subscription. // subscription.
CloseNotificationChannelIfFull bool CloseNotificationChannelIfFull bool
NonBlockingNotificationsDispatcher bool
} }
// notificationReceiver is an interface aimed to provide WS subscriber functionality // notificationReceiver is an interface aimed to provide WS subscriber functionality
@ -589,7 +590,11 @@ readloop:
break readloop break readloop
} }
} }
if c.wsOpts.NonBlockingNotificationsDispatcher {
go c.notifySubscribers(ntf)
} else {
c.notifySubscribers(ntf) c.notifySubscribers(ntf)
}
} else if rr.ID != nil && (rr.Error != nil || rr.Result != nil) { } else if rr.ID != nil && (rr.Error != nil || rr.Result != nil) {
id, err := strconv.ParseUint(string(rr.ID), 10, 64) id, err := strconv.ParseUint(string(rr.ID), 10, 64)
if err != nil { if err != nil {