Skip to content

Commit dd928c4

Browse files
authored
Ignore guest devices and empty IPs when migrating from Synapse (#4121)
2 parents f48bd51 + b6bb596 commit dd928c4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/syn2mas/src/migration.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ async fn migrate_devices(
414414
// As we're using a real IP type in the MAS database, it is possible
415415
// that we encounter invalid IP addresses in the Synapse database.
416416
// In that case, we should ignore them, but still log a warning.
417-
let last_active_ip = ip.and_then(|ip| {
417+
// One special case: Synapse will record '-' as IP in some cases, we don't want
418+
// to log about those
419+
let last_active_ip = ip.filter(|ip| ip != "-").and_then(|ip| {
418420
ip.parse()
419421
.map_err(|e| {
420422
tracing::warn!(

crates/syn2mas/src/synapse_reader/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ impl<'conn> SynapseReader<'conn> {
416416
SELECT
417417
user_id, device_id, display_name, last_seen, ip, user_agent
418418
FROM devices
419-
WHERE NOT hidden
419+
WHERE NOT hidden AND device_id != 'guest_device'
420420
",
421421
)
422422
.fetch(&mut *self.txn)

0 commit comments

Comments
 (0)