0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-30 18:44:00 +01:00

Merge branch 'develop' of github.com:matrix-org/synapse into erikj/perf

This commit is contained in:
Erik Johnston 2015-05-14 12:01:38 +01:00
commit 36ea26c5c0
3 changed files with 14 additions and 3 deletions

View file

@ -117,7 +117,7 @@ Installing prerequisites on Mac OS X::
To install the synapse homeserver run:: To install the synapse homeserver run::
$ virtualenv ~/.synapse $ virtualenv -p python2.7 ~/.synapse
$ source ~/.synapse/bin/activate $ source ~/.synapse/bin/activate
$ pip install --process-dependency-links https://github.com/matrix-org/synapse/tarball/master $ pip install --process-dependency-links https://github.com/matrix-org/synapse/tarball/master

View file

@ -310,6 +310,7 @@ class SQLBaseStore(object):
self._access_tokens_id_gen = IdGenerator("access_tokens", "id", self) self._access_tokens_id_gen = IdGenerator("access_tokens", "id", self)
self._pushers_id_gen = IdGenerator("pushers", "id", self) self._pushers_id_gen = IdGenerator("pushers", "id", self)
self._push_rule_id_gen = IdGenerator("push_rules", "id", self) self._push_rule_id_gen = IdGenerator("push_rules", "id", self)
self._push_rules_enable_id_gen = IdGenerator("push_rules_enable", "id", self)
def start_profiling(self): def start_profiling(self):
self._previous_loop_ts = self._clock.time_msec() self._previous_loop_ts = self._clock.time_msec()

View file

@ -204,11 +204,21 @@ class PushRuleStore(SQLBaseStore):
@defer.inlineCallbacks @defer.inlineCallbacks
def set_push_rule_enabled(self, user_name, rule_id, enabled): def set_push_rule_enabled(self, user_name, rule_id, enabled):
yield self._simple_upsert( ret = yield self.runInteraction(
"_set_push_rule_enabled_txn",
self._set_push_rule_enabled_txn,
user_name, rule_id, enabled
)
defer.returnValue(ret)
def _set_push_rule_enabled_txn(self, txn, user_name, rule_id, enabled):
new_id = self._push_rules_enable_id_gen.get_next_txn(txn)
self._simple_upsert_txn(
txn,
PushRuleEnableTable.table_name, PushRuleEnableTable.table_name,
{'user_name': user_name, 'rule_id': rule_id}, {'user_name': user_name, 'rule_id': rule_id},
{'enabled': 1 if enabled else 0}, {'enabled': 1 if enabled else 0},
desc="set_push_rule_enabled", {'id': new_id},
) )