You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ListenNotifications is performing two asynchronuous operatations:
Register for the actual registration of the notifications.
Notifcations that are actually coming in.
Because notifications only are coming in after step 1, you need to make sure that this has been completed, before the function returns.
Go doesn't suffer from this problem, because it doesn't expose async to the caller and it probably uses a callback for the notifications. There are several ways to fix this:
Use a Go-style approach that implements an async subscribe function that only returns after it actually has subscribed. This function takes an async delegate as a parameter that is invoked whenever a notification is signalled.
Use a more traditional C# implementation that returns Task<IObservable> and returns the observable after subscribing to the object. Although mixing async and IObservable is non-typical, it makes sense here.
The
ListenNotifications
is performing two asynchronuous operatations:Because notifications only are coming in after step 1, you need to make sure that this has been completed, before the function returns.
Go doesn't suffer from this problem, because it doesn't expose async to the caller and it probably uses a callback for the notifications. There are several ways to fix this:
async
subscribe function that only returns after it actually has subscribed. This function takes an async delegate as a parameter that is invoked whenever a notification is signalled.Task<IObservable>
and returns the observable after subscribing to the object. Although mixingasync
andIObservable
is non-typical, it makes sense here.See also #1130 (comment).
The text was updated successfully, but these errors were encountered: