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.
45 lines
1.5 KiB
Swift
45 lines
1.5 KiB
Swift
import XCTest
|
|
@testable import Luma
|
|
|
|
final class ArchiveSyncRecoveryPolicyTests: XCTestCase {
|
|
func testIncrementalOverlapDoesNotReplaySeveralMinutesPerPass() {
|
|
XCTAssertEqual(ArchiveSyncRecoveryPolicy.incrementalOverlap, 60)
|
|
}
|
|
|
|
func testQueryTimeoutIsFinite() {
|
|
XCTAssertGreaterThan(ArchiveSyncRecoveryPolicy.queryTimeoutNanoseconds, 0)
|
|
XCTAssertLessThanOrEqual(
|
|
ArchiveSyncRecoveryPolicy.queryTimeoutNanoseconds,
|
|
20_000_000_000
|
|
)
|
|
}
|
|
|
|
func testPageApplicationAlsoHasAFiniteWatchdog() {
|
|
XCTAssertGreaterThan(ArchiveSyncRecoveryPolicy.pageApplyTimeoutNanoseconds, 0)
|
|
XCTAssertLessThanOrEqual(
|
|
ArchiveSyncRecoveryPolicy.pageApplyTimeoutNanoseconds,
|
|
ArchiveSyncRecoveryPolicy.queryTimeoutNanoseconds
|
|
)
|
|
}
|
|
|
|
func testFailedPagesHaveAtMostOneAutomaticRetry() {
|
|
XCTAssertEqual(ArchiveSyncRecoveryPolicy.pageRetryLimit, 1)
|
|
}
|
|
|
|
func testCatchUpRetryDelayAndCapAreBounded() {
|
|
XCTAssertGreaterThan(
|
|
ArchiveSyncRecoveryPolicy.retryAfterFailureDelayNanoseconds,
|
|
0
|
|
)
|
|
XCTAssertGreaterThan(ArchiveSyncRecoveryPolicy.maximumAutomaticRetries, 0)
|
|
XCTAssertLessThanOrEqual(ArchiveSyncRecoveryPolicy.maximumAutomaticRetries, 5)
|
|
}
|
|
|
|
func testCaptureResumeDelayLetsCameraReleaseResources() {
|
|
XCTAssertGreaterThan(
|
|
ArchiveSyncRecoveryPolicy.resumeAfterCaptureDelayNanoseconds,
|
|
ArchiveSyncRecoveryPolicy.interPageDelayNanoseconds
|
|
)
|
|
}
|
|
}
|