Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 14b2ebe

Browse files
authored
Merge pull request #7055 from matrix-org/babolivier/get_time_of_last_push_action_before
Move get_time_of_last_push_action_before to the EventPushActionsWorkerStore
2 parents 06eb5ca + f9e3a3f commit 14b2ebe

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

changelog.d/7055.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Merge worker apps together.

synapse/push/mailer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,12 @@ def make_summary_text(
555555
else:
556556
# If the reason room doesn't have a name, say who the messages
557557
# are from explicitly to avoid, "messages in the Bob room"
558+
room_id = reason["room_id"]
559+
558560
sender_ids = list(
559561
{
560562
notif_events[n["event_id"]].sender
561-
for n in notifs_by_room[reason["room_id"]]
563+
for n in notifs_by_room[room_id]
562564
}
563565
)
564566

synapse/storage/data_stores/main/event_push_actions.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,23 @@ def _find_first_stream_ordering_after_ts_txn(txn, ts):
608608

609609
return range_end
610610

611+
@defer.inlineCallbacks
612+
def get_time_of_last_push_action_before(self, stream_ordering):
613+
def f(txn):
614+
sql = (
615+
"SELECT e.received_ts"
616+
" FROM event_push_actions AS ep"
617+
" JOIN events e ON ep.room_id = e.room_id AND ep.event_id = e.event_id"
618+
" WHERE ep.stream_ordering > ?"
619+
" ORDER BY ep.stream_ordering ASC"
620+
" LIMIT 1"
621+
)
622+
txn.execute(sql, (stream_ordering,))
623+
return txn.fetchone()
624+
625+
result = yield self.db.runInteraction("get_time_of_last_push_action_before", f)
626+
return result[0] if result else None
627+
611628

612629
class EventPushActionsStore(EventPushActionsWorkerStore):
613630
EPA_HIGHLIGHT_INDEX = "epa_highlight_index"
@@ -735,23 +752,6 @@ def f(txn):
735752
pa["actions"] = _deserialize_action(pa["actions"], pa["highlight"])
736753
return push_actions
737754

738-
@defer.inlineCallbacks
739-
def get_time_of_last_push_action_before(self, stream_ordering):
740-
def f(txn):
741-
sql = (
742-
"SELECT e.received_ts"
743-
" FROM event_push_actions AS ep"
744-
" JOIN events e ON ep.room_id = e.room_id AND ep.event_id = e.event_id"
745-
" WHERE ep.stream_ordering > ?"
746-
" ORDER BY ep.stream_ordering ASC"
747-
" LIMIT 1"
748-
)
749-
txn.execute(sql, (stream_ordering,))
750-
return txn.fetchone()
751-
752-
result = yield self.db.runInteraction("get_time_of_last_push_action_before", f)
753-
return result[0] if result else None
754-
755755
@defer.inlineCallbacks
756756
def get_latest_push_action_stream_ordering(self):
757757
def f(txn):

0 commit comments

Comments
 (0)