Skip to content

Commit

Permalink
Increase last seen granularity to 1h
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Mar 28, 2024
1 parent 29ff49f commit f439f41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions synapse/storage/databases/main/client_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@

# Number of msec of granularity to store the user IP 'last seen' time. Smaller
# times give more inserts into the database even for readonly API hits
# 120 seconds == 2 minutes
LAST_SEEN_GRANULARITY = 120 * 1000
# 120 seconds == 2 minutes, Beep: updated to 1h
LAST_SEEN_GRANULARITY = 3600 * 1000

DISABLE_CLIENT_IP_STORAGE = environ.get("SYNAPSE_DISABLE_CLIENT_IP_STORAGE") == "true"

Expand Down
4 changes: 2 additions & 2 deletions tests/storage/test_client_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_insert_new_client_ip_none_device_id(self) -> None:
user_id, "access_token", "ip", "user_agent", None
)
)
self.reactor.advance(200)
self.reactor.advance(3600)
self.pump(0)

result = cast(
Expand Down Expand Up @@ -153,7 +153,7 @@ def test_insert_new_client_ip_none_device_id(self) -> None:
)
# Only one result, has been upserted.
self.assertEqual(
result, [("access_token", "ip", "user_agent", None, 12345878000)]
result, [("access_token", "ip", "user_agent", None, 12349278000)]
)

@parameterized.expand([(False,), (True,)])
Expand Down

0 comments on commit f439f41

Please sign in to comment.