-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Two identical streams are both deleted when calling RemoveStream on one of them #13
Comments
Most client libraries seem to have overcome this by wrapping streams into an "object", that keeps track of how many active listeners there currently are and only if all listeners are removed, the api call to remove the stream would be issued... But this requires a higher level interface to the api calls, so a low level api would indeed require support from the server... |
Yes, this could easily be done by the client and I wouldn't mind implementing it. I raised the issue because I think the overall direction taken by kRPC is to avoid features being developed multiple times in clients. |
Apologies for the slow reply. This is indeed done to save on network usage and improve performance. The client libraries I've written actually don't do reference counting (I verified this in the python client, and am pretty sure all the others work the same). When a stream is removed, all duplicates of the stream are also removed. I see how this could be confusing to the library user - and having the removal reference counted is probably better. Doing the reference counting on the server would indeed be best - to avoid re-implementation efforts in each client. However, we should be careful to do it in such a way that existing versions of clients continue to work with the same behaviour though. Maybe add a boolean flag to |
This looks like a good idea. Similarly we could add this flag in the |
Hey !
When making identical stream requests it appears the same stream id is returned and a single update is sent with each StreamUpdate instead of two. The behavior seems to be the same whether these requests are made in distinct packets or together in a batch.
For example, using the client I'm working on:
Produces:
This could be a problem when those streams are created by independent parts of the client program and one of them decides it no longer needs the stream and removes it. When that happens, the stream disappears for both of them.
I believe this behavior is intended to minimize the amount of data sent to the client. Maybe a counter could be added server-side so that in the above scenario two calls to RemoveStream are necessary to completely remove the stream.
The text was updated successfully, but these errors were encountered: