Skip to main content

set_test_exclusive_hold_for_testing

Function set_test_exclusive_hold_for_testing 

Source
pub async fn set_test_exclusive_hold_for_testing(
    conn: &mut PgConnection,
    user_id: Uuid,
    course_id: Option<Uuid>,
    held_until: DateTime<Utc>,
) -> ModelResult<()>
Expand description

Excuses every one of a user’s rows (or, with course_id, just that course’s) from unscoped claim_due calls until held_until; a scoped call ignores every hold regardless (see claim_due). Keyed on identity rather than a row id so a spec can hold before materialize creates the row it means to protect, closing the window a row-id hold could only ever narrow: the live background worker ticks every 10s regardless of any single test, so a hold applied after the row exists still races the worker’s own next tick.

Exists only for test setup: nothing in the product ever needs to hide a user’s rows from the worker that owns them.