Ignore guest devices and empty IPs when migrating from Synapse (#4121)

This commit is contained in:
Quentin Gliech
2025-03-04 08:33:30 +01:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@@ -414,7 +414,9 @@ async fn migrate_devices(
// As we're using a real IP type in the MAS database, it is possible
// that we encounter invalid IP addresses in the Synapse database.
// In that case, we should ignore them, but still log a warning.
let last_active_ip = ip.and_then(|ip| {
// One special case: Synapse will record '-' as IP in some cases, we don't want
// to log about those
let last_active_ip = ip.filter(|ip| ip != "-").and_then(|ip| {
ip.parse()
.map_err(|e| {
tracing::warn!(

View File

@@ -416,7 +416,7 @@ impl<'conn> SynapseReader<'conn> {
SELECT
user_id, device_id, display_name, last_seen, ip, user_agent
FROM devices
WHERE NOT hidden
WHERE NOT hidden AND device_id != 'guest_device'
",
)
.fetch(&mut *self.txn)