mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:26:02 -04:00
Move storage functions for push calculations
This will allow push actions for an event to be calculated on workers.
This commit is contained in:
parent
3594dbc6dc
commit
493e25d554
6 changed files with 101 additions and 98 deletions
|
@ -15,6 +15,10 @@
|
|||
# limitations under the License.
|
||||
|
||||
from ._base import SQLBaseStore
|
||||
from synapse.storage.appservice import ApplicationServiceWorkerStore
|
||||
from synapse.storage.pusher import PusherWorkerStore
|
||||
from synapse.storage.receipts import ReceiptsWorkerStore
|
||||
from synapse.storage.roommember import RoomMemberWorkerStore
|
||||
from synapse.util.caches.descriptors import cachedInlineCallbacks, cachedList
|
||||
from synapse.util.caches.stream_change_cache import StreamChangeCache
|
||||
from synapse.push.baserules import list_with_base_rules
|
||||
|
@ -51,7 +55,11 @@ def _load_rules(rawrules, enabled_map):
|
|||
return rules
|
||||
|
||||
|
||||
class PushRulesWorkerStore(SQLBaseStore):
|
||||
class PushRulesWorkerStore(ApplicationServiceWorkerStore,
|
||||
ReceiptsWorkerStore,
|
||||
PusherWorkerStore,
|
||||
RoomMemberWorkerStore,
|
||||
SQLBaseStore):
|
||||
"""This is an abstract base class where subclasses must implement
|
||||
`get_max_push_rules_stream_id` which can be called in the initializer.
|
||||
"""
|
||||
|
@ -140,8 +148,6 @@ class PushRulesWorkerStore(SQLBaseStore):
|
|||
"have_push_rules_changed", have_push_rules_changed_txn
|
||||
)
|
||||
|
||||
|
||||
class PushRuleStore(PushRulesWorkerStore):
|
||||
@cachedList(cached_method_name="get_push_rules_for_user",
|
||||
list_name="user_ids", num_args=1, inlineCallbacks=True)
|
||||
def bulk_get_push_rules(self, user_ids):
|
||||
|
@ -281,6 +287,8 @@ class PushRuleStore(PushRulesWorkerStore):
|
|||
results.setdefault(row['user_name'], {})[row['rule_id']] = enabled
|
||||
defer.returnValue(results)
|
||||
|
||||
|
||||
class PushRuleStore(PushRulesWorkerStore):
|
||||
@defer.inlineCallbacks
|
||||
def add_push_rule(
|
||||
self, user_id, rule_id, priority_class, conditions, actions,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue