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
Currently, Dealers maintain an internal counter of pending requests, which is incremented when a request is sent by the Dealer and decremented when a response is received. observer.OnCompleted() is called if the pending request counter drops to 0. This works for a request / response pattern where there is a pair relationship between the Dealer and another socket. However, dealers can be used in different architectures (e.g. many-to-one in a client / server pattern) where this may become a problem.
For example:
We have 2 dealers (D1, D2) that can send a request to a Router. The router broadcasts the response back to both dealers. If D1 sends a request it increments pendingRequests on the outgoing message and decrements back to 1 on the incoming message. D2 only receives the incoming message, decrements pendingRequests to 0 and closes. We may in fact want D2 to stay alive to listen to more messages.
Is there a reason to maintain the request counter at all? Dealers could be used more flexibly without it. Alternatively, we could expose the request counter from the Dealer node and leave it up to the Bonsai workflow how to deal with it.
The text was updated successfully, but these errors were encountered:
glopesdev
changed the title
Dealer Observables can be closed inappropriately by other sockets
Dealer operator can be closed inappropriately by other sockets
May 22, 2023
Currently, Dealers maintain an internal counter of pending requests, which is incremented when a request is sent by the Dealer and decremented when a response is received.
observer.OnCompleted()
is called if the pending request counter drops to 0. This works for a request / response pattern where there is a pair relationship between the Dealer and another socket. However, dealers can be used in different architectures (e.g. many-to-one in a client / server pattern) where this may become a problem.For example:
We have 2 dealers (D1, D2) that can send a request to a Router. The router broadcasts the response back to both dealers. If D1 sends a request it increments
pendingRequests
on the outgoing message and decrements back to 1 on the incoming message. D2 only receives the incoming message, decrementspendingRequests
to 0 and closes. We may in fact want D2 to stay alive to listen to more messages.Is there a reason to maintain the request counter at all? Dealers could be used more flexibly without it. Alternatively, we could expose the request counter from the Dealer node and leave it up to the Bonsai workflow how to deal with it.
The text was updated successfully, but these errors were encountered: