@@ -1740,42 +1740,6 @@ def _clear_old_push_actions_staging_txn(txn: LoggingTransaction) -> bool:
1740
1740
# We sleep to ensure that we don't overwhelm the DB.
1741
1741
await self ._clock .sleep (1.0 )
1742
1742
1743
-
1744
- class EventPushActionsStore (EventPushActionsWorkerStore ):
1745
- EPA_HIGHLIGHT_INDEX = "epa_highlight_index"
1746
-
1747
- def __init__ (
1748
- self ,
1749
- database : DatabasePool ,
1750
- db_conn : LoggingDatabaseConnection ,
1751
- hs : "HomeServer" ,
1752
- ):
1753
- super ().__init__ (database , db_conn , hs )
1754
-
1755
- self .db_pool .updates .register_background_index_update (
1756
- self .EPA_HIGHLIGHT_INDEX ,
1757
- index_name = "event_push_actions_u_highlight" ,
1758
- table = "event_push_actions" ,
1759
- columns = ["user_id" , "stream_ordering" ],
1760
- )
1761
-
1762
- self .db_pool .updates .register_background_index_update (
1763
- "event_push_actions_highlights_index" ,
1764
- index_name = "event_push_actions_highlights_index" ,
1765
- table = "event_push_actions" ,
1766
- columns = ["user_id" , "room_id" , "topological_ordering" , "stream_ordering" ],
1767
- where_clause = "highlight=1" ,
1768
- )
1769
-
1770
- # Add index to make deleting old push actions faster.
1771
- self .db_pool .updates .register_background_index_update (
1772
- "event_push_actions_stream_highlight_index" ,
1773
- index_name = "event_push_actions_stream_highlight_index" ,
1774
- table = "event_push_actions" ,
1775
- columns = ["highlight" , "stream_ordering" ],
1776
- where_clause = "highlight=0" ,
1777
- )
1778
-
1779
1743
async def get_push_actions_for_user (
1780
1744
self ,
1781
1745
user_id : str ,
@@ -1834,6 +1798,42 @@ def f(
1834
1798
]
1835
1799
1836
1800
1801
+ class EventPushActionsStore (EventPushActionsWorkerStore ):
1802
+ EPA_HIGHLIGHT_INDEX = "epa_highlight_index"
1803
+
1804
+ def __init__ (
1805
+ self ,
1806
+ database : DatabasePool ,
1807
+ db_conn : LoggingDatabaseConnection ,
1808
+ hs : "HomeServer" ,
1809
+ ):
1810
+ super ().__init__ (database , db_conn , hs )
1811
+
1812
+ self .db_pool .updates .register_background_index_update (
1813
+ self .EPA_HIGHLIGHT_INDEX ,
1814
+ index_name = "event_push_actions_u_highlight" ,
1815
+ table = "event_push_actions" ,
1816
+ columns = ["user_id" , "stream_ordering" ],
1817
+ )
1818
+
1819
+ self .db_pool .updates .register_background_index_update (
1820
+ "event_push_actions_highlights_index" ,
1821
+ index_name = "event_push_actions_highlights_index" ,
1822
+ table = "event_push_actions" ,
1823
+ columns = ["user_id" , "room_id" , "topological_ordering" , "stream_ordering" ],
1824
+ where_clause = "highlight=1" ,
1825
+ )
1826
+
1827
+ # Add index to make deleting old push actions faster.
1828
+ self .db_pool .updates .register_background_index_update (
1829
+ "event_push_actions_stream_highlight_index" ,
1830
+ index_name = "event_push_actions_stream_highlight_index" ,
1831
+ table = "event_push_actions" ,
1832
+ columns = ["highlight" , "stream_ordering" ],
1833
+ where_clause = "highlight=0" ,
1834
+ )
1835
+
1836
+
1837
1837
def _action_has_highlight (actions : Collection [Union [Mapping , str ]]) -> bool :
1838
1838
for action in actions :
1839
1839
if not isinstance (action , dict ):
0 commit comments