feat(dm): log a 'window settled' line when every relay is done or stalled

The demand-driven rewrite dropped the round model's 'load done: all relays'
completion line, leaving no aggregate signal for 'this is as far as history
goes right now'. Log one per protocol on the exhausted false->true edge, with
the done vs stalled relay breakdown, restoring that diagnostic.
This commit is contained in:
Claude
2026-06-04 22:48:06 +00:00
parent 0394ec2a75
commit b9c2c646fd
3 changed files with 18 additions and 0 deletions
@@ -217,7 +217,13 @@ class AccountGiftWrapsHistoryEoseManager(
val stalled = stalledRelays[user.pubkeyHex] ?: emptySet()
val pending = relays.any { !pager.isDone(user.pubkeyHex, it) && it !in stalled }
val ex = !pending
val was = exhaustedByUser[user.pubkeyHex] ?: false
exhaustedByUser[user.pubkeyHex] = ex
if (ex && !was) {
val done = relays.filter { pager.isDone(user.pubkeyHex, it) }.map { it.url }
val stuck = relays.filter { it in stalled && !pager.isDone(user.pubkeyHex, it) }.map { it.url }
Log.d(TAG) { "[giftwrap.history] window settled (nothing more reachable) — done=$done stalled=$stuck" }
}
if (activeUser == user.pubkeyHex) _exhausted.value = ex
}
@@ -207,7 +207,13 @@ class ChatroomNip04HistorySubAssembler(
val stalled = stalledRelays[pk] ?: emptySet()
val pending = relays.all.any { !pager.isDone(pk, it) && it !in stalled }
val ex = !pending
val was = exhaustedByConvo[pk] ?: false
exhaustedByConvo[pk] = ex
if (ex && !was) {
val done = relays.all.filter { pager.isDone(pk, it) }.map { it.url }
val stuck = relays.all.filter { it in stalled && !pager.isDone(pk, it) }.map { it.url }
Log.d("DMPagination") { "[convo.nip04.history] window settled (nothing more reachable) — done=$done stalled=$stuck" }
}
if (activeConvo == pk) _exhausted.value = ex
}
@@ -193,7 +193,13 @@ class ChatroomListNip04HistorySubAssembler(
val stalled = stalledRelays[user.pubkeyHex] ?: emptySet()
val pending = relays.any { !pager.isDone(user.pubkeyHex, it) && it !in stalled }
val ex = !pending
val was = exhaustedByUser[user.pubkeyHex] ?: false
exhaustedByUser[user.pubkeyHex] = ex
if (ex && !was) {
val done = relays.filter { pager.isDone(user.pubkeyHex, it) }.map { it.url }
val stuck = relays.filter { it in stalled && !pager.isDone(user.pubkeyHex, it) }.map { it.url }
Log.d("DMPagination") { "[rooms.nip04.history] window settled (nothing more reachable) — done=$done stalled=$stuck" }
}
if (activeUser == user.pubkeyHex) _exhausted.value = ex
}