mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
fix: Only emit TransportsModified if transports are really modified
Otherwise it's not possible to write tests reliably because sync messages may be executed multiple times if they arrive from different transports. This should fix flaky `test_transport_synchronization`. Also always emit `TransportsModified` if the primary transport is changed by a sync message, even if it doesn't contain `SyncData::Transports`. Also don't decrease `add_timestamp` in `save_transport()` if nothing else changes, this doesn't make sense.
This commit is contained in:
@@ -832,7 +832,9 @@ pub(crate) async fn receive_imf_inner(
|
||||
|
||||
let transport_changed = if transport_exists {
|
||||
transaction.execute(
|
||||
"UPDATE config SET value=? WHERE keyname='configured_addr'",
|
||||
"
|
||||
UPDATE config SET value=? WHERE keyname='configured_addr' AND value!=?1
|
||||
",
|
||||
(from_addr,),
|
||||
)? > 0
|
||||
} else {
|
||||
@@ -848,6 +850,7 @@ pub(crate) async fn receive_imf_inner(
|
||||
if transport_changed {
|
||||
info!(context, "Primary transport changed to {from_addr:?}.");
|
||||
context.sql.uncache_raw_config("configured_addr").await;
|
||||
context.emit_event(EventType::TransportsModified);
|
||||
}
|
||||
} else {
|
||||
warn!(context, "Sync items are not encrypted.");
|
||||
|
||||
Reference in New Issue
Block a user