diff options
author | Matthew Hodgson <matthew@matrix.org> | 2018-06-04 00:09:17 +0300 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2018-06-04 00:09:17 +0300 |
commit | 28f09fcdd51796dd5036cb74e62b7a74d753f4be (patch) | |
tree | 40f098938d04cf93c8f7bb7aa82af879479b3334 /synapse/storage/presence.py | |
parent | more comments (diff) | |
parent | Merge pull request #3317 from thegcat/feature/3312-add_ipv6_to_blacklist_exam... (diff) | |
download | synapse-28f09fcdd51796dd5036cb74e62b7a74d753f4be.tar.xz |
Merge branch 'develop' into matthew/filter_members
Diffstat (limited to 'synapse/storage/presence.py')
-rw-r--r-- | synapse/storage/presence.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/synapse/storage/presence.py b/synapse/storage/presence.py index 9e9d3c2591..f05d91cc58 100644 --- a/synapse/storage/presence.py +++ b/synapse/storage/presence.py @@ -16,6 +16,7 @@ from ._base import SQLBaseStore from synapse.api.constants import PresenceState from synapse.util.caches.descriptors import cached, cachedInlineCallbacks, cachedList +from synapse.util import batch_iter from collections import namedtuple from twisted.internet import defer @@ -115,11 +116,7 @@ class PresenceStore(SQLBaseStore): " AND user_id IN (%s)" ) - batches = ( - presence_states[i:i + 50] - for i in xrange(0, len(presence_states), 50) - ) - for states in batches: + for states in batch_iter(presence_states, 50): args = [stream_id] args.extend(s.user_id for s in states) txn.execute( |