Merge lp://staging/~tealeg/landscape-client/scoped_session_ids into lp://staging/~landscape/landscape-client/trunk
Status: | Merged |
---|---|
Approved by: | Geoff Teale |
Approved revision: | 711 |
Merged at revision: | 704 |
Proposed branch: | lp://staging/~tealeg/landscape-client/scoped_session_ids |
Merge into: | lp://staging/~landscape/landscape-client/trunk |
Prerequisite: | lp://staging/~tealeg/landscape-client/broker_handles_scoped_resynch |
Diff against target: |
229 lines (+81/-18) 9 files modified
landscape/broker/amp.py (+1/-1) landscape/broker/client.py (+2/-1) landscape/broker/exchange.py (+1/-1) landscape/broker/server.py (+2/-2) landscape/broker/store.py (+3/-3) landscape/broker/tests/test_client.py (+12/-0) landscape/broker/tests/test_exchange.py (+29/-6) landscape/broker/tests/test_server.py (+12/-0) landscape/broker/tests/test_store.py (+19/-4) |
To merge this branch: | bzr merge lp://staging/~tealeg/landscape-client/scoped_session_ids |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Glass (community) | Approve | ||
Free Ekanayaka (community) | Approve | ||
Review via email: mp+173232@code.staging.launchpad.net |
This proposal supersedes a proposal from 2013-07-05.
Commit message
This branch propogates the scopes parameter of get_session_id
up from the MessageStore to the MessageExchange and utilises
this parameter when registering a BrokerClientPlugin with the BrokerClient (taking the scope of the BrokerClientPlu
Additionally, when handling the resynchronize event (which
gets the scope from the incoming ResynchronizeRe
pass the scopes parameter into drop_session_ids, which will
limit the dropping/blocking of messages to those sent with the
old session ids of those scopes.
Description of the change
This branch propogates the scopes parameter of get_session_id up from the MessageStore to the MessageExchange and utilises this parameter when registering a BrokerClientPlugin with the BrokerClient (taking the scope of the BrokerClientPlu
Nice work in keeping these branches small, it really helps. +1!
#1
# When re-synchronisation occurs we don't want any previous messages store.drop_ session_ ids() store.drop_ session_ ids(scopes)
# being sent to the server, dropping the existing session_ids means
# that messages sent with those IDs will be dropped by the broker.
- self._message_
+ self._message_
Please expand the comment mentioning that only the session IDs for the specified scopes will be dropped (or all of them if scopes is None).
#2
- def get_session_ id(self) : id(self, scope=None):
+ def get_session_
There should be a @param entry for the new parameter, in the method docstring.
#3
- def drop_session_ ids(self, scope=None): ids(self, scopes=None):
+ def drop_session_
"""
Drop all session ids.
"""
Please update the method docstring and document the new parameter.
#4
+ test_session_id = self.successRes ultOf( broker. get_session_ id(scope= "test") )
+ self.client.
Opinionated nitpick: since this is using 2 lines anyways, I find it generally better to split it like this:
deferred = self.client. broker. get_session_ id(scope= "test")
test_session_ id = self.successRes ultOf(deferred)
because imo there's less parsing work going on in one's mind when reading the code. This is really minor (and I guess a counter argument could be made), so your call.
#5
+ global_scope = [] fire("resynchro nize-clients" , global_scope)
+ self.reactor.
This is probably a leftover, you can just:
which defaults to the global scope.
#6
+ self.assertMess ages(messages, [{"type": "empty"}])
This doesn't test which one of the 2 sessions IDs generated the message exactly, it'd be nice to use 2 different message types I guess. Maybe it's not needed from a strict unit-test point of view, since I believe test_drop_ multiple_ scopes from test_store.py covers that. Your call.