diff options
author | David Baker <dave@matrix.org> | 2016-01-04 13:39:29 +0000 |
---|---|---|
committer | David Baker <dave@matrix.org> | 2016-01-04 13:39:29 +0000 |
commit | 3051c9d002a467643d1ab32bc36974d2e3f84c12 (patch) | |
tree | 0d660fd86194ded09dcb416f40c0dea40f0dcd2e /synapse/storage | |
parent | Fix merge fail with anon access stuff (diff) | |
download | synapse-3051c9d002a467643d1ab32bc36974d2e3f84c12.tar.xz |
Address minor PR issues
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/event_actions.py | 2 | ||||
-rw-r--r-- | synapse/storage/push_rule.py | 6 | ||||
-rw-r--r-- | synapse/storage/registration.py | 12 |
3 files changed, 4 insertions, 16 deletions
diff --git a/synapse/storage/event_actions.py b/synapse/storage/event_actions.py index 3efa445c18..fa9cbe71ee 100644 --- a/synapse/storage/event_actions.py +++ b/synapse/storage/event_actions.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2014 OpenMarket Ltd +# Copyright 2015 OpenMarket Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/synapse/storage/push_rule.py b/synapse/storage/push_rule.py index 9dec4aa685..7c5123d644 100644 --- a/synapse/storage/push_rule.py +++ b/synapse/storage/push_rule.py @@ -62,12 +62,12 @@ class PushRuleStore(SQLBaseStore): def f(txn, user_ids_to_fetch): sql = ( "SELECT " + - ",".join(map(lambda x: "pr."+x, PushRuleTable.fields)) + + ",".join("pr."+x for x in PushRuleTable.fields) + " FROM " + PushRuleTable.table_name + " pr " + " LEFT JOIN " + PushRuleEnableTable.table_name + " pre " + " ON pr.user_name = pre.user_name and pr.rule_id = pre.rule_id " + " WHERE pr.user_name " + - " IN (" + ",".join(["?" for _ in user_ids_to_fetch]) + ")" + " IN (" + ",".join("?" for _ in user_ids_to_fetch) + ")" " AND (pre.enabled is null or pre.enabled = 1)" " ORDER BY pr.user_name, pr.priority_class DESC, pr.priority DESC" ) @@ -78,7 +78,7 @@ class PushRuleStore(SQLBaseStore): batch_start = 0 while batch_start < len(user_ids): - batch_end = max(len(user_ids), batch_size) + batch_end = min(len(user_ids), batch_size) batch_user_ids = user_ids[batch_start:batch_end] batch_start = batch_end diff --git a/synapse/storage/registration.py b/synapse/storage/registration.py index 4676f225b9..09a05b08ef 100644 --- a/synapse/storage/registration.py +++ b/synapse/storage/registration.py @@ -292,18 +292,6 @@ class RegistrationStore(SQLBaseStore): defer.returnValue(None) @defer.inlineCallbacks - def get_all_user_ids(self): - """Returns all user ids registered on this homeserver""" - return self.runInteraction( - "get_all_user_ids", - self._get_all_user_ids_txn - ) - - def _get_all_user_ids_txn(self, txn): - txn.execute("SELECT name from users") - return [r[0] for r in txn.fetchall()] - - @defer.inlineCallbacks def count_all_users(self): """Counts all users registered on the homeserver.""" def _count_users(txn): |