gatewayd: serve_restart takes the two caught-up turns in either order
The two posts caught up at restart are two top-level posts, so two sessions, and their turns run on their own threads. gatewayd starts them in order, but which one reaches loopd first is up to the scheduler. Under load the test failed about 1 run in 60; task 18's session hit it once. mm_json.rs already checks the order of catch-up (reversing the sort fails there), so this test now compares the two turns as a set. It passed 100 of 100 runs under load. The M4a plan's copy is left as it was handed over. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -41,12 +41,14 @@ fn a_restart_reports_the_cut_off_turn_and_catches_up() {
|
||||
);
|
||||
let _running = start(config(&home, &mm.url(), ""));
|
||||
let _ws = mm.next_ws(WAIT);
|
||||
let first = turns.recv_timeout(WAIT).unwrap();
|
||||
let second = turns.recv_timeout(WAIT).unwrap();
|
||||
assert_eq!(
|
||||
(first.content.as_str(), second.content.as_str()),
|
||||
("first", "second")
|
||||
);
|
||||
// Two top-level posts are two sessions, whose turns run on their own threads: they may reach
|
||||
// `loopd` in either order. The order of catch-up itself is `mm_json.rs`'s to check.
|
||||
let mut got = [
|
||||
turns.recv_timeout(WAIT).unwrap().content,
|
||||
turns.recv_timeout(WAIT).unwrap().content,
|
||||
];
|
||||
got.sort();
|
||||
assert_eq!(got, ["first", "second"]);
|
||||
let posts = mm.wait_posts(3, WAIT);
|
||||
assert_eq!(posts[0], (DM.to_string(), cut, INTERRUPTED.to_string()));
|
||||
assert_eq!(posts.len(), 3, "{posts:?}");
|
||||
|
||||
Reference in New Issue
Block a user