fix: release post-publish refreshes on ingest confirmation instead of a blind delay - #645
Merged
Merged
Conversation
… a blind delay The refresh after publishing slept a fixed 5 seconds, fetched once, and gave up: if the nanopub had not been ingested by then, the one fetch returned the old data and the view settled on stale content until a manual reload (issue #629). The wait is now a measurement: clearCache can be handed the just-published nanopub's id, and the background refresh polls the new check-nanopub-loaded query (a single indexed lookup on the meta repo) until the query services report the nanopub as loaded, plus a small margin for trailing repos and instances. The polling is hard-bounded (20s cap, 1s interval), shared between the several views refreshing after the same publish, and never runs on a request thread. If the probe fails or times out, the blind fallback delay applies unchanged, so a broken probe cannot make publishing worse than before. Fixes #629 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #629 (the round-trip-confirmation half of #622, left out of #627).
Problem
Publishing set a blind 5-second
runAfterdelay, after which the background refresh fetched exactly once and dropped theforcedRefreshflag. If the nanopub had not been ingested within those 5 seconds, that one fetch returned the old data,RefreshingResultPanel.pollsaw an unchanged digest, and settled — spinner off, stale content left on screen permanently. A too-slow ingest was indistinguishable from "nothing changed".Change
The wait is now a measurement instead of a guess:
check-nanopub-loaded— a single indexed lookup on the meta repo (graph npa:graph { ?_np_iri dct:created ?date } limit 1, ~120ms) reporting whether the answering query-service instance has the nanopub.get-latest-version-of-npwas deliberately not reused: its pubkey join,(npx:supersedes)*path, andNOT EXISTSmake it too expensive for a retry loop. Already published and live.QueryApiAccess.isNanopubLoaded(npId)wraps it, uncached.ApiCache.clearCachegains a variant taking the just-published nanopub's id (passed through by the publish listener inWicketApplication). The fourrunAfterwait sites now share one helper,waitOutIngestDelay: poll the probe until the nanopub is confirmed as loaded, then release the refresh after a 1s margin (for trailing repos/instances).Safety properties
retrieveResponseSync, punting to the background as the plain delay already did.No client-side changes:
RefreshPollTimer's 60s deadline already accommodates the longer server-side wait.Testing
🤖 Generated with Claude Code