Skip to main content

CLAIM_ACTION

Constant CLAIM_ACTION 

Source
pub const CLAIM_ACTION: &str = "DELETE FROM queue WHERE id = :id RETURNING id";
Expand description

Deletes the row an owner is about to apply, and reports whether it was still there.

It runs first in the applying transaction, not last: the pending rows are read outside any transaction, so a second owner reading the same list would otherwise apply every action twice, and add and copy are not idempotent. Claiming the row first makes exactly-once a property of the statement rather than a convention about who drains.