diff options
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/storage/data_stores/main/event_push_actions.py | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/synapse/storage/data_stores/main/event_push_actions.py b/synapse/storage/data_stores/main/event_push_actions.py index 382e0f61c2..b1a2804b34 100644 --- a/synapse/storage/data_stores/main/event_push_actions.py +++ b/synapse/storage/data_stores/main/event_push_actions.py @@ -40,15 +40,13 @@ DEFAULT_HIGHLIGHT_ACTION = [ @attr.s -class EventPushSummary(object): +class EventPushSummary: """Summary of pending event push actions for a given user in a given room.""" - user_id = attr.ib() - room_id = attr.ib() - unread_count = attr.ib() - stream_ordering = attr.ib() - old_user_id = attr.ib() - notif_count = attr.ib() + unread_count = attr.ib(type=int) + stream_ordering = attr.ib(type=int) + old_user_id = attr.ib(type=str) + notif_count = attr.ib(type=int) def _serialize_action(actions, is_highlight): @@ -886,8 +884,6 @@ class EventPushActionsStore(EventPushActionsWorkerStore): summaries = {} # type: Dict[Tuple[str, str], EventPushSummary] for row in txn: summaries[(row[0], row[1])] = EventPushSummary( - user_id=row[0], - room_id=row[1], unread_count=row[2], stream_ordering=row[3], old_user_id=row[4], @@ -915,13 +911,13 @@ class EventPushActionsStore(EventPushActionsWorkerStore): table="event_push_summary", values=[ { - "user_id": summary.user_id, - "room_id": summary.room_id, + "user_id": user_id, + "room_id": room_id, "notif_count": summary.notif_count, "unread_count": summary.unread_count, "stream_ordering": summary.stream_ordering, } - for summary in summaries.values() + for ((user_id, room_id), summary) in summaries.items() if summary.old_user_id is None ], ) @@ -937,10 +933,10 @@ class EventPushActionsStore(EventPushActionsWorkerStore): summary.notif_count, summary.unread_count, summary.stream_ordering, - summary.user_id, - summary.room_id, + user_id, + room_id, ) - for summary in summaries.values() + for ((user_id, room_id), summary) in summaries.items() if summary.old_user_id is not None ), ) |