Skip to content
Snippets Groups Projects
Commit 099ce4bc authored by Erik Johnston's avatar Erik Johnston
Browse files

Merge pull request #231 from matrix-org/erikj/pushers_store_last_token

Push: store the 'last_token' in the db, even if we processed no events
parents 22346a0e 78fa346b
No related branches found
No related tags found
No related merge requests found
...@@ -294,6 +294,12 @@ class Pusher(object): ...@@ -294,6 +294,12 @@ class Pusher(object):
if not single_event: if not single_event:
self.last_token = chunk['end'] self.last_token = chunk['end']
logger.debug("Event stream timeout for pushkey %s", self.pushkey) logger.debug("Event stream timeout for pushkey %s", self.pushkey)
yield self.store.update_pusher_last_token(
self.app_id,
self.pushkey,
self.user_name,
self.last_token
)
return return
if not self.alive: if not self.alive:
...@@ -345,7 +351,7 @@ class Pusher(object): ...@@ -345,7 +351,7 @@ class Pusher(object):
if processed: if processed:
self.backoff_delay = Pusher.INITIAL_BACKOFF self.backoff_delay = Pusher.INITIAL_BACKOFF
self.last_token = chunk['end'] self.last_token = chunk['end']
self.store.update_pusher_last_token_and_success( yield self.store.update_pusher_last_token_and_success(
self.app_id, self.app_id,
self.pushkey, self.pushkey,
self.user_name, self.user_name,
...@@ -354,7 +360,7 @@ class Pusher(object): ...@@ -354,7 +360,7 @@ class Pusher(object):
) )
if self.failing_since: if self.failing_since:
self.failing_since = None self.failing_since = None
self.store.update_pusher_failing_since( yield self.store.update_pusher_failing_since(
self.app_id, self.app_id,
self.pushkey, self.pushkey,
self.user_name, self.user_name,
...@@ -362,7 +368,7 @@ class Pusher(object): ...@@ -362,7 +368,7 @@ class Pusher(object):
else: else:
if not self.failing_since: if not self.failing_since:
self.failing_since = self.clock.time_msec() self.failing_since = self.clock.time_msec()
self.store.update_pusher_failing_since( yield self.store.update_pusher_failing_since(
self.app_id, self.app_id,
self.pushkey, self.pushkey,
self.user_name, self.user_name,
...@@ -380,7 +386,7 @@ class Pusher(object): ...@@ -380,7 +386,7 @@ class Pusher(object):
self.user_name, self.pushkey) self.user_name, self.pushkey)
self.backoff_delay = Pusher.INITIAL_BACKOFF self.backoff_delay = Pusher.INITIAL_BACKOFF
self.last_token = chunk['end'] self.last_token = chunk['end']
self.store.update_pusher_last_token( yield self.store.update_pusher_last_token(
self.app_id, self.app_id,
self.pushkey, self.pushkey,
self.user_name, self.user_name,
...@@ -388,7 +394,7 @@ class Pusher(object): ...@@ -388,7 +394,7 @@ class Pusher(object):
) )
self.failing_since = None self.failing_since = None
self.store.update_pusher_failing_since( yield self.store.update_pusher_failing_since(
self.app_id, self.app_id,
self.pushkey, self.pushkey,
self.user_name, self.user_name,
......
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