diff options
author | Erik Johnston <erik@matrix.org> | 2018-08-09 10:16:16 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2018-08-09 10:16:16 +0100 |
commit | 5785b93711da5e61cb6d446d090bb7daac5d61c8 (patch) | |
tree | e7dc98431b7f52526f85439e785f58a51df89553 /synapse/storage/client_ips.py | |
parent | Pull in necessary stores in federation_reader (diff) | |
parent | Merge pull request #3632 from matrix-org/erikj/refactor_repl_servlet (diff) | |
download | synapse-5785b93711da5e61cb6d446d090bb7daac5d61c8.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/split_federation
Diffstat (limited to 'synapse/storage/client_ips.py')
-rw-r--r-- | synapse/storage/client_ips.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/synapse/storage/client_ips.py b/synapse/storage/client_ips.py index b8cefd43d6..2489527f2c 100644 --- a/synapse/storage/client_ips.py +++ b/synapse/storage/client_ips.py @@ -35,6 +35,7 @@ LAST_SEEN_GRANULARITY = 120 * 1000 class ClientIpStore(background_updates.BackgroundUpdateStore): def __init__(self, db_conn, hs): + self.client_ip_last_seen = Cache( name="client_ip_last_seen", keylen=4, @@ -74,6 +75,7 @@ class ClientIpStore(background_updates.BackgroundUpdateStore): "before", "shutdown", self._update_client_ips_batch ) + @defer.inlineCallbacks def insert_client_ip(self, user_id, access_token, ip, user_agent, device_id, now=None): if not now: @@ -84,7 +86,7 @@ class ClientIpStore(background_updates.BackgroundUpdateStore): last_seen = self.client_ip_last_seen.get(key) except KeyError: last_seen = None - + yield self.populate_monthly_active_users(user_id) # Rate-limited inserts if last_seen is not None and (now - last_seen) < LAST_SEEN_GRANULARITY: return |