fix: une tentative dépassée n'ouvre plus rien, et libère ce qu'elle avait ouvert
This commit is contained in:
@@ -82,6 +82,17 @@ interface Observation {
|
||||
enumerating: boolean;
|
||||
/** A trigger that arrived mid-cycle: the running one repeats once rather than lose it. */
|
||||
enumerateAgain: boolean;
|
||||
/**
|
||||
* True while the shortfall reported by the last enumeration is still the SAME one — so a
|
||||
* register that stays unreadable is reported once, not once per cycle.
|
||||
*
|
||||
* Every signal this observation listens to runs a full cycle, and a persistent shortfall
|
||||
* is re-read by each of them, so the condition is reported as many times as the identity
|
||||
* is nudged: one deposit produced three copies of the same line. That is what buries the
|
||||
* report that matters under the report that repeats. Cleared the moment a list comes back
|
||||
* WHOLE, so a shortfall that goes away and returns is a new occurrence and says so.
|
||||
*/
|
||||
shortfallReported: boolean;
|
||||
/** Enumerations and applications in flight — what {@link observationSettled} waits on. */
|
||||
pending: Set<Promise<void>>;
|
||||
}
|
||||
@@ -178,6 +189,11 @@ async function applyWhatArrived(obs: Observation, inbox: Nuri): Promise<void> {
|
||||
* and the inboxes it is missing are watched on the next enumeration — which is what the
|
||||
* register push and the holdings signal are for. Applying what lands in a user inbox is
|
||||
* itself one of those signals (it files a cap), so the ordinary case repairs itself.
|
||||
*
|
||||
* Once per OCCURRENCE, though, not once per enumeration — see
|
||||
* {@link Observation.shortfallReported}. The retry that repairs it is also what re-reads it,
|
||||
* so a condition that persists is re-discovered by every signal; reporting each discovery
|
||||
* says "it happened again" about the single thing that never stopped happening.
|
||||
*/
|
||||
async function watchTheInboxes(obs: Observation): Promise<void> {
|
||||
if (!current(obs)) return;
|
||||
@@ -190,7 +206,10 @@ async function watchTheInboxes(obs: Observation): Promise<void> {
|
||||
return;
|
||||
}
|
||||
if (!current(obs)) return;
|
||||
if (listed.incomplete !== null) {
|
||||
if (listed.incomplete === null) {
|
||||
obs.shortfallReported = false;
|
||||
} else if (!obs.shortfallReported) {
|
||||
obs.shortfallReported = true;
|
||||
reportUnobserved("the inboxes to watch could not all be listed", listed.incomplete.error);
|
||||
}
|
||||
for (const inbox of listed.inboxes) {
|
||||
@@ -354,6 +373,7 @@ export async function startObservingInboxes(): Promise<void> {
|
||||
holdings: null,
|
||||
enumerating: false,
|
||||
enumerateAgain: false,
|
||||
shortfallReported: false,
|
||||
pending: new Set(),
|
||||
};
|
||||
observation = obs;
|
||||
|
||||
Reference in New Issue
Block a user