0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-16 00:43:51 +01:00

Don't make the pushers' event streams cause people to appear online

This commit is contained in:
David Baker 2015-01-15 16:17:21 +00:00
parent 2cb30767fa
commit e3e2fc3255
2 changed files with 26 additions and 23 deletions

View file

@ -47,11 +47,11 @@ class EventStreamHandler(BaseHandler):
@defer.inlineCallbacks
@log_function
def get_stream(self, auth_user_id, pagin_config, timeout=0,
as_client_event=True):
as_client_event=True, affect_presence=True):
auth_user = self.hs.parse_userid(auth_user_id)
try:
if auth_user not in self._streams_per_user:
if affect_presence and auth_user not in self._streams_per_user:
self._streams_per_user[auth_user] = 0
if auth_user in self._stop_timer_per_user:
try:
@ -92,6 +92,7 @@ class EventStreamHandler(BaseHandler):
defer.returnValue(chunk)
finally:
if affect_presence:
self._streams_per_user[auth_user] -= 1
if not self._streams_per_user[auth_user]:
del self._streams_per_user[auth_user]

View file

@ -81,7 +81,9 @@ class Pusher(object):
from_tok = StreamToken.from_string(self.last_token)
config = PaginationConfig(from_token=from_tok, limit='1')
chunk = yield self.evStreamHandler.get_stream(
self.user_name, config, timeout=100*365*24*60*60*1000)
self.user_name, config,
timeout=100*365*24*60*60*1000, affect_presence=False
)
# limiting to 1 may get 1 event plus 1 presence event, so
# pick out the actual event