mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Move get_time_of_last_push_action_before
to the EventPushActionsWorkerStore
Fixes #7054 I also had a look at the rest of the functions in `EventPushActionsStore` and in the push notifications send code and it looks to me like there shouldn't be any other method with this issue in this part of the codebase.
This commit is contained in:
parent
87972f07e5
commit
87c65576e0
@ -608,6 +608,23 @@ class EventPushActionsWorkerStore(SQLBaseStore):
|
|||||||
|
|
||||||
return range_end
|
return range_end
|
||||||
|
|
||||||
|
@defer.inlineCallbacks
|
||||||
|
def get_time_of_last_push_action_before(self, stream_ordering):
|
||||||
|
def f(txn):
|
||||||
|
sql = (
|
||||||
|
"SELECT e.received_ts"
|
||||||
|
" FROM event_push_actions AS ep"
|
||||||
|
" JOIN events e ON ep.room_id = e.room_id AND ep.event_id = e.event_id"
|
||||||
|
" WHERE ep.stream_ordering > ?"
|
||||||
|
" ORDER BY ep.stream_ordering ASC"
|
||||||
|
" LIMIT 1"
|
||||||
|
)
|
||||||
|
txn.execute(sql, (stream_ordering,))
|
||||||
|
return txn.fetchone()
|
||||||
|
|
||||||
|
result = yield self.db.runInteraction("get_time_of_last_push_action_before", f)
|
||||||
|
return result[0] if result else None
|
||||||
|
|
||||||
|
|
||||||
class EventPushActionsStore(EventPushActionsWorkerStore):
|
class EventPushActionsStore(EventPushActionsWorkerStore):
|
||||||
EPA_HIGHLIGHT_INDEX = "epa_highlight_index"
|
EPA_HIGHLIGHT_INDEX = "epa_highlight_index"
|
||||||
@ -735,23 +752,6 @@ class EventPushActionsStore(EventPushActionsWorkerStore):
|
|||||||
pa["actions"] = _deserialize_action(pa["actions"], pa["highlight"])
|
pa["actions"] = _deserialize_action(pa["actions"], pa["highlight"])
|
||||||
return push_actions
|
return push_actions
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
|
||||||
def get_time_of_last_push_action_before(self, stream_ordering):
|
|
||||||
def f(txn):
|
|
||||||
sql = (
|
|
||||||
"SELECT e.received_ts"
|
|
||||||
" FROM event_push_actions AS ep"
|
|
||||||
" JOIN events e ON ep.room_id = e.room_id AND ep.event_id = e.event_id"
|
|
||||||
" WHERE ep.stream_ordering > ?"
|
|
||||||
" ORDER BY ep.stream_ordering ASC"
|
|
||||||
" LIMIT 1"
|
|
||||||
)
|
|
||||||
txn.execute(sql, (stream_ordering,))
|
|
||||||
return txn.fetchone()
|
|
||||||
|
|
||||||
result = yield self.db.runInteraction("get_time_of_last_push_action_before", f)
|
|
||||||
return result[0] if result else None
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_latest_push_action_stream_ordering(self):
|
def get_latest_push_action_stream_ordering(self):
|
||||||
def f(txn):
|
def f(txn):
|
||||||
|
Loading…
Reference in New Issue
Block a user