[fm] Activate sitrep loader when rendezvous detects a stale sitrep.#10622
Open
mergeconflict wants to merge 1 commit into
Open
Conversation
When a SitrepGuardedInsert outcome reports that the executing sitrep is stale, the database already has a newer current sitrep than the one this Nexus has loaded. Poke the fm_sitrep_loader background task so that the newer sitrep is picked up promptly, rather than on the loader's next periodic activation; the loader in turn re-activates rendezvous with the fresh sitrep. The periodic loader timer already bounded the staleness window, so this is a responsiveness improvement, not a correctness fix. Suggested by @hawkw in review of #10533.
hawkw
reviewed
Jun 15, 2026
Comment on lines
+586
to
+604
| /// Asserts that `activator` has been activated, panicking with `msg` if | ||
| /// it has not. | ||
| /// | ||
| /// `Activator::activate()` stores a permit synchronously, so by the time | ||
| /// a test's activation has completed, the activator is either already | ||
| /// activated or never will be; a single poll suffices to tell which. | ||
| #[track_caller] | ||
| fn assert_activated(activator: &Activator, msg: &str) { | ||
| let mut activated = tokio_test::task::spawn(activator.activated()); | ||
| tokio_test::assert_ready!(activated.poll(), "{}", msg); | ||
| } | ||
|
|
||
| /// Asserts that `activator` has not been activated, panicking with `msg` | ||
| /// if it has. See [`assert_activated`]. | ||
| #[track_caller] | ||
| fn assert_not_activated(activator: &Activator, msg: &str) { | ||
| let mut activated = tokio_test::task::spawn(activator.activated()); | ||
| tokio_test::assert_pending!(activated.poll(), "{}", msg); | ||
| } |
Member
There was a problem hiding this comment.
there's similar code in some other background task tests, IIRC. I wonder if this is worth factoring out --- perhaps as test-only methods on Activator?
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.
When a
SitrepGuardedInsertoutcome reports that the executing sitrep is stale, the database already has a newer current sitrep than the one this Nexus has loaded. Poke thefm_sitrep_loaderbackground task so that the newer sitrep is picked up promptly, rather than on the loader's next periodic activation; the loader in turn re-activates rendezvous with the fresh sitrep.The periodic loader timer already bounded the staleness window, so this is a responsiveness improvement, not a correctness fix.
Suggested by @hawkw in #10533.