thread - Replace O(n^2) origin-id/stanza-id lookups in AppModel with hash indexes and stop rebuilding the whole index on every unseen stanza-id, so archive application no longer grows quadratically with history size. - Run OMEMO decryption on a serial background queue instead of the main actor, and decrypt archived stanzas in small batches with a shorter yield, keeping the UI responsive during large archive catch-ups. - Show the "Синхронизация истории…" banner only for the one-page bootstrap window; incremental backlog catch-up continues silently in the background. - Fix MUC-MAM: publish decoded group mutations at the end of room catch-up; they were previously accumulated and then silently dropped. - Retry a failed catch-up pass automatically (bounded) and lengthen the query/apply timeouts so a single slow page no longer leaves history unloaded until the next app activation.
20 lines
1.0 KiB
Swift
20 lines
1.0 KiB
Swift
import Foundation
|
|
|
|
/// Bounds whole-query MAM recovery so a server that keeps returning the same
|
|
/// broken page cannot leave the client in an endless restart loop.
|
|
enum ArchiveSyncRecoveryPolicy {
|
|
static let incrementalOverlap: TimeInterval = 60
|
|
static let interPageDelayNanoseconds: UInt64 = 100_000_000
|
|
static let queryTimeoutNanoseconds: UInt64 = 20_000_000_000
|
|
static let pageApplyTimeoutNanoseconds: UInt64 = 20_000_000_000
|
|
static let pageRetryLimit = 1
|
|
static let resumeAfterCaptureDelayNanoseconds: UInt64 = 3_000_000_000
|
|
/// Delay before automatically resuming a failed catch-up pass while the
|
|
/// app stays connected and foregrounded. Prevents a single slow page from
|
|
/// silently leaving history unloaded until the next app activation.
|
|
static let retryAfterFailureDelayNanoseconds: UInt64 = 20_000_000_000
|
|
/// Consecutive automatic catch-up retries before falling back to
|
|
/// resume-on-activation, so a persistently broken server cannot loop.
|
|
static let maximumAutomaticRetries = 3
|
|
}
|