diff options
-rw-r--r-- | synapse/handlers/device.py | 2 | ||||
-rw-r--r-- | synapse/handlers/initial_sync.py | 1 | ||||
-rw-r--r-- | synapse/handlers/presence.py | 3 | ||||
-rw-r--r-- | synapse/handlers/room_list.py | 2 | ||||
-rw-r--r-- | synapse/handlers/sync.py | 2 | ||||
-rw-r--r-- | synapse/push/emailpusher.py | 2 | ||||
-rw-r--r-- | synapse/rest/client/v1/room.py | 1 | ||||
-rw-r--r-- | synapse/storage/event_push_actions.py | 9 | ||||
-rw-r--r-- | synapse/storage/events.py | 8 | ||||
-rw-r--r-- | synapse/storage/search.py | 2 |
10 files changed, 23 insertions, 9 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index ca7137f315..419bfef562 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -327,7 +327,7 @@ class DeviceHandler(BaseHandler): user_id ) logger.info("Extrem: %r, prev_ids: %r", extremity, prev_ids) - if str(extremity) == str(prev_ids[0]): + if extremity and prev_ids[0] and int(extremity) >= int(prev_ids[0]): resync = False if resync: diff --git a/synapse/handlers/initial_sync.py b/synapse/handlers/initial_sync.py index e0ade4c164..a1274c0b6a 100644 --- a/synapse/handlers/initial_sync.py +++ b/synapse/handlers/initial_sync.py @@ -363,6 +363,7 @@ class InitialSyncHandler(BaseHandler): @defer.inlineCallbacks def get_presence(): + defer.returnValue([]) states = yield presence_handler.get_states( [m.user_id for m in room_members], as_event=True, diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index da610e430f..921971dc4b 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -373,6 +373,7 @@ class PresenceHandler(object): """We've seen the user do something that indicates they're interacting with the app. """ + return user_id = user.to_string() bump_active_time_counter.inc() @@ -402,6 +403,7 @@ class PresenceHandler(object): Useful for streams that are not associated with an actual client that is being used by a user. """ + affect_presence = False if affect_presence: curr_sync = self.user_to_num_current_syncs.get(user_id, 0) self.user_to_num_current_syncs[user_id] = curr_sync + 1 @@ -463,6 +465,7 @@ class PresenceHandler(object): syncing_user_ids(set(str)): The set of user_ids that are currently syncing on that server. """ + return # Grab the previous list of user_ids that were syncing on that process prev_syncing_user_ids = ( diff --git a/synapse/handlers/room_list.py b/synapse/handlers/room_list.py index 19eebbd43f..326a992abf 100644 --- a/synapse/handlers/room_list.py +++ b/synapse/handlers/room_list.py @@ -42,7 +42,7 @@ EMTPY_THIRD_PARTY_ID = ThirdPartyInstanceID(None, None) class RoomListHandler(BaseHandler): def __init__(self, hs): super(RoomListHandler, self).__init__(hs) - self.response_cache = ResponseCache(hs) + self.response_cache = ResponseCache(hs, timeout_ms=10 * 60 * 1000) self.remote_response_cache = ResponseCache(hs, timeout_ms=30 * 1000) def get_local_public_room_list(self, limit=None, since_token=None, diff --git a/synapse/handlers/sync.py b/synapse/handlers/sync.py index d7dcd1ce5b..71ecceb97c 100644 --- a/synapse/handlers/sync.py +++ b/synapse/handlers/sync.py @@ -539,7 +539,7 @@ class SyncHandler(object): since_token is None and sync_config.filter_collection.blocks_all_presence() ) - if not block_all_presence_data: + if False or not block_all_presence_data: yield self._generate_sync_entry_for_presence( sync_result_builder, newly_joined_rooms, newly_joined_users ) diff --git a/synapse/push/emailpusher.py b/synapse/push/emailpusher.py index c7afd11111..b3e0098a86 100644 --- a/synapse/push/emailpusher.py +++ b/synapse/push/emailpusher.py @@ -219,7 +219,7 @@ class EmailPusher(object): def seconds_until(self, ts_msec): secs = (ts_msec - self.clock.time_msec()) / 1000 - return max(secs, 0) + return max(secs, 0) # Ensure non-negative def get_room_throttle_ms(self, room_id): if room_id in self.throttle_params: diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index 90242a6bac..4f28b791fc 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -474,6 +474,7 @@ class RoomInitialSyncRestServlet(ClientV1RestServlet): @defer.inlineCallbacks def on_GET(self, request, room_id): + # raise RuntimeError("Guest access has been disabled") requester = yield self.auth.get_user_by_req(request, allow_guest=True) pagination_config = PaginationConfig.from_request(request) content = yield self.initial_sync_handler.room_initial_sync( diff --git a/synapse/storage/event_push_actions.py b/synapse/storage/event_push_actions.py index 14543b4269..d138aaf540 100644 --- a/synapse/storage/event_push_actions.py +++ b/synapse/storage/event_push_actions.py @@ -87,6 +87,8 @@ class EventPushActionsStore(SQLBaseStore): self._rotate_notif_loop = self._clock.looping_call( self._rotate_notifs, 30 * 60 * 1000 ) + self._rotate_delay = 3 + self._rotate_count = 10000 def _set_push_actions_for_event_and_users_txn(self, txn, event, tuples): """ @@ -629,7 +631,7 @@ class EventPushActionsStore(SQLBaseStore): ) if caught_up: break - yield sleep(5) + yield sleep(self._rotate_delay) finally: self._doing_notif_rotation = False @@ -650,9 +652,10 @@ class EventPushActionsStore(SQLBaseStore): txn.execute(""" SELECT stream_ordering FROM event_push_actions WHERE stream_ordering > ? - ORDER BY stream_ordering ASC LIMIT 1 OFFSET 50000 - """, (old_rotate_stream_ordering,)) + ORDER BY stream_ordering ASC LIMIT 1 OFFSET ? + """, (old_rotate_stream_ordering, self._rotate_count)) stream_row = txn.fetchone() + # stream_row = (old_rotate_stream_ordering + self._rotate_count,) if stream_row: offset_stream_ordering, = stream_row rotate_to_stream_ordering = min( diff --git a/synapse/storage/events.py b/synapse/storage/events.py index db01eb6d14..8506421b67 100644 --- a/synapse/storage/events.py +++ b/synapse/storage/events.py @@ -780,7 +780,6 @@ class EventsStore(SQLBaseStore): "event_edge_hashes", "event_edges", "event_forward_extremities", - "event_push_actions", "event_reference_hashes", "event_search", "event_signatures", @@ -799,6 +798,13 @@ class EventsStore(SQLBaseStore): "DELETE FROM %s WHERE event_id = ?" % (table,), [(ev.event_id,) for ev, _ in events_and_contexts] ) + for table in ( + "event_push_actions", + ): + txn.executemany( + "DELETE FROM %s WHERE room_id = ? AND event_id = ?" % (table,), + [(ev.event_id,) for ev, _ in events_and_contexts] + ) self._simple_insert_many_txn( txn, diff --git a/synapse/storage/search.py b/synapse/storage/search.py index 8f2b3c4435..17c6c55714 100644 --- a/synapse/storage/search.py +++ b/synapse/storage/search.py @@ -600,7 +600,7 @@ def _parse_query(database_engine, search_term): results = re.findall(r"([\w\-]+)", search_term, re.UNICODE) if isinstance(database_engine, PostgresEngine): - return " & ".join(result + ":*" for result in results) + return " & ".join(result for result in results) elif isinstance(database_engine, Sqlite3Engine): return " & ".join(result + "*" for result in results) else: |