Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dealer operator can be closed inappropriately by other sockets #15

Closed
RoboDoig opened this issue Mar 23, 2023 · 0 comments
Closed

Dealer operator can be closed inappropriately by other sockets #15

RoboDoig opened this issue Mar 23, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@RoboDoig
Copy link
Collaborator

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.

@glopesdev 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
@glopesdev glopesdev added the bug Something isn't working label May 22, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants