Skip to content
Snippets Groups Projects
Commit 017dfaef authored by Mark Haines's avatar Mark Haines
Browse files

Add doc string for __nonzero__ overrides for sync results, raise not...

Add doc string for __nonzero__ overrides for sync results, raise not implemented if the client attempts to do a gapless sync
parent 8bc3066e
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,9 @@ class RoomSyncResult(collections.namedtuple("RoomSyncResult", [ ...@@ -49,6 +49,9 @@ class RoomSyncResult(collections.namedtuple("RoomSyncResult", [
__slots__ = [] __slots__ = []
def __nonzero__(self): def __nonzero__(self):
"""Make the result appear empty if there are no updates. This is used
to tell if room needs to be part of the sync result.
"""
return bool(self.events or self.state or self.ephemeral) return bool(self.events or self.state or self.ephemeral)
...@@ -61,6 +64,10 @@ class SyncResult(collections.namedtuple("SyncResult", [ ...@@ -61,6 +64,10 @@ class SyncResult(collections.namedtuple("SyncResult", [
__slots__ = [] __slots__ = []
def __nonzero__(self): def __nonzero__(self):
"""Make the result appear empty if there are no updates. This is used
to tell if the notifier needs to wait for more events when polling for
events.
"""
return bool( return bool(
self.private_user_data or self.public_user_data or self.rooms self.private_user_data or self.public_user_data or self.rooms
) )
...@@ -108,7 +115,7 @@ class SyncHandler(BaseHandler): ...@@ -108,7 +115,7 @@ class SyncHandler(BaseHandler):
return self.incremental_sync_with_gap(sync_config, since_token) return self.incremental_sync_with_gap(sync_config, since_token)
else: else:
#TODO(mjark): Handle gapless sync #TODO(mjark): Handle gapless sync
pass raise NotImplementedError()
@defer.inlineCallbacks @defer.inlineCallbacks
def initial_sync(self, sync_config): def initial_sync(self, sync_config):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment