mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 21:04:59 -04:00
Convert additional databases to async/await part 2 (#8200)
This commit is contained in:
parent
bbb3c8641c
commit
da77520cd1
15 changed files with 111 additions and 81 deletions
|
@ -18,8 +18,6 @@ import abc
|
|||
import logging
|
||||
from typing import List, Tuple, Union
|
||||
|
||||
from twisted.internet import defer
|
||||
|
||||
from synapse.push.baserules import list_with_base_rules
|
||||
from synapse.replication.slave.storage._slaved_id_tracker import SlavedIdTracker
|
||||
from synapse.storage._base import SQLBaseStore, db_to_json
|
||||
|
@ -149,9 +147,11 @@ class PushRulesWorkerStore(
|
|||
)
|
||||
return {r["rule_id"]: False if r["enabled"] == 0 else True for r in results}
|
||||
|
||||
def have_push_rules_changed_for_user(self, user_id, last_id):
|
||||
async def have_push_rules_changed_for_user(
|
||||
self, user_id: str, last_id: int
|
||||
) -> bool:
|
||||
if not self.push_rules_stream_cache.has_entity_changed(user_id, last_id):
|
||||
return defer.succeed(False)
|
||||
return False
|
||||
else:
|
||||
|
||||
def have_push_rules_changed_txn(txn):
|
||||
|
@ -163,7 +163,7 @@ class PushRulesWorkerStore(
|
|||
(count,) = txn.fetchone()
|
||||
return bool(count)
|
||||
|
||||
return self.db_pool.runInteraction(
|
||||
return await self.db_pool.runInteraction(
|
||||
"have_push_rules_changed", have_push_rules_changed_txn
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue