mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-05-08 10:45:11 -04:00
First bits of emailpusher
Mostly logic of when to send an email
This commit is contained in:
parent
48af68ba8e
commit
07d765209d
7 changed files with 335 additions and 8 deletions
|
@ -230,3 +230,30 @@ class PusherStore(SQLBaseStore):
|
|||
{'failing_since': failing_since},
|
||||
desc="update_pusher_failing_since",
|
||||
)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_throttle_params_by_room(self, pusher_id):
|
||||
res = yield self._simple_select_list(
|
||||
"pusher_throttle",
|
||||
{"pusher": pusher_id},
|
||||
["room_id", "last_sent_ts", "throttle_ms"],
|
||||
desc="get_throttle_params_by_room"
|
||||
)
|
||||
|
||||
params_by_room = {}
|
||||
for row in res:
|
||||
params_by_room[row["room_id"]] = {
|
||||
"last_sent_ts": row["last_sent_ts"],
|
||||
"throttle_ms": row["throttle_ms"]
|
||||
}
|
||||
|
||||
defer.returnValue(params_by_room)
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def set_throttle_params(self, pusher_id, room_id, params):
|
||||
yield self._simple_upsert(
|
||||
"pusher_throttle",
|
||||
{"pusher": pusher_id, "room_id": room_id},
|
||||
params,
|
||||
desc="set_throttle_params"
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue