mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-16 23:03:53 +01:00
Always use the latest stream_id, sent or unsent
This commit is contained in:
parent
d1e1fd6210
commit
76100203ab
1 changed files with 4 additions and 4 deletions
|
@ -280,14 +280,14 @@ class DeviceStore(SQLBaseStore):
|
||||||
prev_sent_id_sql = """
|
prev_sent_id_sql = """
|
||||||
SELECT coalesce(max(stream_id), 0) as stream_id
|
SELECT coalesce(max(stream_id), 0) as stream_id
|
||||||
FROM device_lists_outbound_pokes
|
FROM device_lists_outbound_pokes
|
||||||
WHERE destination = ? AND user_id = ? AND sent = ?
|
WHERE destination = ? AND user_id = ? AND stream_id <= ?
|
||||||
"""
|
"""
|
||||||
|
|
||||||
results = []
|
results = []
|
||||||
for user_id, user_devices in devices.iteritems():
|
for user_id, user_devices in devices.iteritems():
|
||||||
# We bind literal True, as its database dependent how booleans are
|
# The prev_id for the first row is always the last row before
|
||||||
# handled.
|
# `from_stream_id`
|
||||||
txn.execute(prev_sent_id_sql, (destination, user_id, True))
|
txn.execute(prev_sent_id_sql, (destination, user_id, from_stream_id))
|
||||||
rows = txn.fetchall()
|
rows = txn.fetchall()
|
||||||
prev_id = rows[0][0]
|
prev_id = rows[0][0]
|
||||||
for device_id, device in user_devices.iteritems():
|
for device_id, device in user_devices.iteritems():
|
||||||
|
|
Loading…
Reference in a new issue