fix: Send pre-message after successful sending of post-message (#8063)

On the receiving side, download post messages w/o known pre-message after 30s to protect from lost
messages.

This isn't easy to test in Rust though because the `smtp` sending code requires an SMTP connection,
so it's only tested (by already existing tests) that messages are queued in the right order.

Another problem is that the `smtp` sending logic doesn't try to send any messages following a
failed-to-send message until the retry limit is reached, so if there's smth wrong with a
post-message, other unrelated messages are delayed, but this problem has already existed.
This commit is contained in:
iequidoo
2026-05-08 00:14:43 -04:00
parent ca70fb9b3a
commit 04832ecabe
10 changed files with 91 additions and 50 deletions

View File

@@ -2385,6 +2385,19 @@ UPDATE msgs SET state=19 WHERE state=24; -- Change OutPreparing to OutFailed.
.await?;
}
inc_and_check(&mut migration_version, 153)?;
if dbversion < migration_version {
sql.execute_migration(
"
CREATE INDEX smtp_index_msg_id ON smtp (msg_id, id);
ALTER TABLE available_post_msgs ADD COLUMN timestamp INTEGER DEFAULT 0 NOT NULL;
CREATE INDEX available_post_msgs_timestamp ON available_post_msgs (timestamp);
",
migration_version,
)
.await?;
}
let new_version = sql
.get_raw_config_int(VERSION_CFG)
.await?