mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
fix: update add_timestamp when the transport is selected as primary
This commit is contained in:
@@ -225,6 +225,9 @@ def test_transport_synchronization(acfactory, log) -> None:
|
|||||||
log.section("ac1 changes the primary transport")
|
log.section("ac1 changes the primary transport")
|
||||||
ac1.set_config("configured_addr", transport3["addr"])
|
ac1.set_config("configured_addr", transport3["addr"])
|
||||||
|
|
||||||
|
# One event for updated `add_timestamp` of the new primary transport,
|
||||||
|
# one event for the `configured_addr` update.
|
||||||
|
ac1_clone.wait_for_event(EventType.TRANSPORTS_MODIFIED)
|
||||||
ac1_clone.wait_for_event(EventType.TRANSPORTS_MODIFIED)
|
ac1_clone.wait_for_event(EventType.TRANSPORTS_MODIFIED)
|
||||||
[transport1, transport3] = ac1_clone.list_transports()
|
[transport1, transport3] = ac1_clone.list_transports()
|
||||||
assert ac1_clone.get_config("configured_addr") == addr3
|
assert ac1_clone.get_config("configured_addr") == addr3
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use crate::log::LogExt;
|
|||||||
use crate::mimefactory::RECOMMENDED_FILE_SIZE;
|
use crate::mimefactory::RECOMMENDED_FILE_SIZE;
|
||||||
use crate::provider::Provider;
|
use crate::provider::Provider;
|
||||||
use crate::sync::{self, Sync::*, SyncData};
|
use crate::sync::{self, Sync::*, SyncData};
|
||||||
use crate::tools::get_abs_path;
|
use crate::tools::{get_abs_path, time};
|
||||||
use crate::transport::{ConfiguredLoginParam, add_pseudo_transport, send_sync_transports};
|
use crate::transport::{ConfiguredLoginParam, add_pseudo_transport, send_sync_transports};
|
||||||
use crate::{constants, stats};
|
use crate::{constants, stats};
|
||||||
|
|
||||||
@@ -828,6 +828,22 @@ impl Context {
|
|||||||
(addr,),
|
(addr,),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
// Update the timestamp for the primary transport
|
||||||
|
// so it becomes the first in `get_all_self_addrs()` list
|
||||||
|
// and the list of relays distributed in the public key.
|
||||||
|
// This ensures that messages will be sent
|
||||||
|
// to the primary relay by the contacts
|
||||||
|
// and will be fetched in background_fetch()
|
||||||
|
// which only fetches from the primary transport.
|
||||||
|
transaction
|
||||||
|
.execute(
|
||||||
|
"UPDATE transports SET add_timestamp=? WHERE addr=?",
|
||||||
|
(time(), addr),
|
||||||
|
)
|
||||||
|
.context(
|
||||||
|
"Failed to update add_timestamp for the new primary transport",
|
||||||
|
)?;
|
||||||
|
|
||||||
// Clean up SMTP and IMAP APPEND queue.
|
// Clean up SMTP and IMAP APPEND queue.
|
||||||
//
|
//
|
||||||
// The messages in the queue have a different
|
// The messages in the queue have a different
|
||||||
|
|||||||
Reference in New Issue
Block a user