diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-09-20 20:14:34 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-20 20:14:34 +1000 |
commit | 1f3f5fcf52efdf5215dc6c7cd3805b1357bf8236 (patch) | |
tree | 0ea1a5b02e4f0659e92b40ea450af96d8a6ab702 /synapse/storage | |
parent | Merge pull request #3914 from matrix-org/erikj/remove_retry_cache (diff) | |
download | synapse-1f3f5fcf52efdf5215dc6c7cd3805b1357bf8236.tar.xz |
Fix client IPs being broken on Python 3 (#3908)
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/client_ips.py | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/synapse/storage/client_ips.py b/synapse/storage/client_ips.py index 8fc678fa67..9ad17b7c25 100644 --- a/synapse/storage/client_ips.py +++ b/synapse/storage/client_ips.py @@ -119,21 +119,25 @@ class ClientIpStore(background_updates.BackgroundUpdateStore): for entry in iteritems(to_update): (user_id, access_token, ip), (user_agent, device_id, last_seen) = entry - self._simple_upsert_txn( - txn, - table="user_ips", - keyvalues={ - "user_id": user_id, - "access_token": access_token, - "ip": ip, - "user_agent": user_agent, - "device_id": device_id, - }, - values={ - "last_seen": last_seen, - }, - lock=False, - ) + try: + self._simple_upsert_txn( + txn, + table="user_ips", + keyvalues={ + "user_id": user_id, + "access_token": access_token, + "ip": ip, + "user_agent": user_agent, + "device_id": device_id, + }, + values={ + "last_seen": last_seen, + }, + lock=False, + ) + except Exception as e: + # Failed to upsert, log and continue + logger.error("Failed to insert client IP %r: %r", entry, e) @defer.inlineCallbacks def get_last_client_ip_by_device(self, user_id, device_id): |