Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/monetize

crates/monetize-server/src/estate_order/tests/clone_sweep_job.rs

//! **The release-clone sweep is a queued jera job** (owner rule: server background work is a
//! jera ChainQueue job, never a raw thread; c1's note 2026-10-18 on `estate-clone-sweep`): the
//! tick's sweep, when due, goes to the estate orders' sweep lane — one keyed job, low priority —
//! and runs there.

use super::*;

#[test]
fn the_tick_queues_the_release_clone_sweep_as_a_jera_job() {
    let r = delivered("clone-sweep-job", cfg());
    let rt = tokio::runtime::Builder::new_multi_thread()
        .worker_threads(2)
        .enable_all()
        .build()
        .unwrap();
    let state = r.state.clone();
    rt.block_on(async move {
        let s = state.clone();
        tokio::task::spawn_blocking(move || maybe_sweep(&s, s.now()))
            .await
            .unwrap();
        let lane = state
            .estates
            .sweep_lane
            .get()
            .cloned()
            .expect("the sweep went to the jera lane");
        for _ in 0..200 {
            if lane.stats().done + lane.stats().failed > 0 {
                break;
            }
            tokio::time::sleep(std::time::Duration::from_millis(25)).await;
        }
        assert_eq!(lane.stats().done, 1, "the sweep ran once, as its job");
    });
}