csync / csync-server

Apache License 2.0
14 stars 4 forks source link

Regurgitate the FQ contents to rabbit upon session close #2

Open narinearraul opened 7 years ago

narinearraul commented 7 years ago

rajamony commented on Aug 25, 2015 This is a tough one (to describe and implement). Today, when a user session closes, we "remove" it and call the cleanup method on UserSession. This in turn flushes the FQ (by calling q.flush), which causes all pending messages for the session that haven't yet been delivered to them to get discarded. A better option would be to not just flush them but instead stuff them in the rabbit message queue. It isn't straightforward to implement (I think) because by the time you are invoking the flush on FQ, you may have canceled the mq. So some thought is required here on how it gets done.

The current mode of operation does not cause a correctness problem. A client will (eventually) reconnect and then either republish or resubscribe and things will all go right again. This fix is really about (a) optimizing what might be a corner case (b) making the flow more elegant.