fix(sync): skip re-processing tracked rejected events in missing-event recovery

Production soak of the unrecoverable-ID fix (PR commit 256a9912,
gitnostr.com, 2026-08-04) showed the bounded exact-ID recovery path
re-delivering already-tracked rejected events once per attempt: 72
redundant write-policy re-validations (and warns) in the first three
minutes after restart before converging.

Consult the rejected events index before processing recovered events,
matching the existing skip in the relay event loop. A tracked ID still
counts as recovered - the relay delivered it - so recovery outcomes are
unchanged; re-validation remains owned by the rejected-index
re-processing machinery, and unrecoverable IDs never revalidate.

Validated with cargo fmt and the sync unit-test suite; behaviour was
observed directly in production logs during the soak.
This commit is contained in:
DanConwayDev
2026-08-04 14:53:51 +00:00
parent 256a9912e5
commit 9d717fe53c
+12
View File
@@ -1860,6 +1860,18 @@ impl SyncManager {
if !requested.contains(&event.id) {
continue;
}
// Events already tracked as rejected count as recovered without
// re-processing: re-validation is owned by the rejected-index
// re-processing machinery, and unrecoverable IDs never revalidate.
if rejected_events_index.contains(&event.id) {
tracing::debug!(
relay = %relay_url,
event_id = %event.id,
"Recovered missing event already tracked as rejected, skipping re-processing"
);
recovered.insert(event.id);
continue;
}
let result = Self::process_event_static(
&event,
&relay_url,