| author | Eric Roberts
<eric@devl.me> 2026-10-02 17:19:57 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-10-05 14:21:10 UTC |
| parent | 6bcd88d92463fde8b0e987dc28cd855e69485f13 |
| borogove/Chat.hx | +16 | -2 |
| borogove/MessageSync.hx | +2 | -0 |
diff --git a/borogove/Chat.hx b/borogove/Chat.hx index 68a98a1..96f78ef 100644 --- a/borogove/Chat.hx +++ b/borogove/Chat.hx @@ -1525,7 +1525,7 @@ class Channel extends Chat { private var inSync = false; @:allow(borogove) private var joinFailed = null; - private var sync = null; + private var sync: Null<MessageSync> = null; private var forceLive = false; @:allow(borogove) private var self: Null<Member> = null; @@ -1896,7 +1896,21 @@ class Channel extends Chat { ); return; } - if (sync != null) return; + if (sync != null) { + trace( + "SYNC: channel doSync skipped, sync already exists", + { + chatId: chatId, + inSync: inSync, + startedAt: Date.format(std.Date.fromTime(sync.startedAt)), + elapsedMs: std.Date.now().getTime() - sync.startedAt, + progress: sync.progress, + lastPage: sync.lastPage, + hasMore: sync.hasMore(), + } + ); + return; + } // Sort into a window so live messages arriving concurrently can come after final sortFrom = sortA ?? syncPoint?.sortId; diff --git a/borogove/MessageSync.hx b/borogove/MessageSync.hx index fbf6cc5..eac1bc7 100644 --- a/borogove/MessageSync.hx +++ b/borogove/MessageSync.hx @@ -35,12 +35,14 @@ class MessageSync { private final startFilter:MessageFilter; private var sortA:Null<String>; private final sortB:Null<String>; + public final startedAt:Float; public var lastPage(default, null):ResultSetPageResult; public var progress(default, null): Int = 0; private var complete:Bool = false; public var jmi(default, null): Map<String, Stanza> = []; public function new(client:Client, stream:GenericStream, filter:MessageFilter, sortA: Null<String>, sortB: Null<String>, ?serviceJID:String) { + this.startedAt = std.Date.now().getTime(); this.client = client; this.stream = stream; this.startFilter = this.filter = Reflect.copy(filter);