diff options
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/presence.py | 2 | ||||
-rw-r--r-- | synapse/storage/databases/main/appservice.py | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/synapse/handlers/presence.py b/synapse/handlers/presence.py index 34d9411bbf..dace31d87e 100644 --- a/synapse/handlers/presence.py +++ b/synapse/handlers/presence.py @@ -1625,7 +1625,7 @@ class PresenceEventSource(EventSource[int, UserPresenceState]): # We'll actually pull the presence updates for these users at the end. interested_and_updated_users: Union[Set[str], FrozenSet[str]] = set() - if from_key: + if from_key is not None: # First get all users that have had a presence update updated_users = stream_change_cache.get_all_entities_changed(from_key) diff --git a/synapse/storage/databases/main/appservice.py b/synapse/storage/databases/main/appservice.py index 0694446558..abea4383c7 100644 --- a/synapse/storage/databases/main/appservice.py +++ b/synapse/storage/databases/main/appservice.py @@ -446,7 +446,8 @@ class ApplicationServiceTransactionWorkerStore( ) last_stream_id = txn.fetchone() if last_stream_id is None or last_stream_id[0] is None: # no row exists - return 0 + # Stream tokens always start from 1, to avoid foot guns around `0` being falsey. + return 1 else: return int(last_stream_id[0]) |