mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:46:06 -04:00
Consistently use six's iteritems and wrap lazy keys/values in list() if they're not meant to be lazy (#3307)
This commit is contained in:
parent
872cf43516
commit
c936a52a9e
29 changed files with 116 additions and 101 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue