Skip to main content

Module person_hold

Module person_hold 

Source
Expand description

A person’s words to an agent out of quota: kept, checked, sent when it can work (task #2648). The person’s words to an agent that is out of quota.

A Swarm broadcast to an agent marked limited used to be refused (“not sent”) and nothing looked at whether the limit was still real; a quota refilled before the provider’s reset left the agent limited for days. Now the words are kept, a check turn starts on the agent at once (limit_probe::check_now, no wait for the 15-minute slot a message between agents has), and the broadcast’s answer waits [CHECK_WAIT_MS] for the result: delivered when the check cleared the limit, otherwise “held”, with the reason. Kept words are sent as soon as the agent can work, whoever cleared it (the check, a clean turn of another agent on its account, the reset), and for at most [KEEP_MS]. The words never ride the check turn: a check that fails leaves the agent limited and the words kept.

Structs§

Pending 🔒
A broadcast’s words kept for an agent out of quota, with its check started: what the answer waits for.
Words 🔒

Constants§

CHECK_WAIT_MS 🔒
How long a broadcast’s answer waits for the check.
FAST_FOR_MS 🔒
HELD_PREFIX 🔒
An answer that starts with this is “kept, not sent yet”, not a failure.
KEEP_MS 🔒
How long words are kept for an agent that stays out of quota (the held-message hold’s 24 hours).
MAX_KEPT 🔒
The most messages kept for one agent.
PENDING_PREFIX 🔒
An answer that starts with this stands for a Pending to be waited for (resolve_pending).
POLL_FAST_MS 🔒
How often the watcher looks while the check is fresh, then after FAST_FOR_MS.
POLL_SLOW_MS 🔒

Statics§

KEPT 🔒
The words kept per pane, oldest first.
NEXT_TICKET 🔒
PARKED 🔒

Functions§

deliver_person_broadcast 🔒
One target of a Swarm broadcast: the person’s words. To an agent that can work they go as a turn; to one out of quota by its plan they are kept and its check starts at once, instead of being refused (resolve_pending then waits for the check, for every such target together); any other agent that cannot work refuses them as before. Only this path keeps: a task start or an agent’s message to a limited agent (deliver_broadcast_turn) still refuses, since it undoes its work on a refusal.
expire 🔒
Drops what has been kept KEEP_MS, answering each sender (if still waiting) with that.
held_note 🔒
The reason in a broadcast answer that means “kept, not sent yet” (HELD_PREFIX); None for a failure.
is_kept_for_check 🔒
Whether a message to an agent in this state is kept and checked, rather than refused: a plan’s limit (not a route out of credits, and not a sign-in: neither ends by itself being asked).
keep 🔒
Keeps words for block_id; true when it is the first (the caller starts the watcher). Err when the agent already has MAX_KEPT.
keep_and_check 🔒
Keeps text for block_id, an agent out of quota, and starts its check turn.
kept_count 🔒
How many are kept for block_id.
resolve_pending 🔒
Waits for every target parked by deliver_person_broadcast together, up to CHECK_WAIT_MS from when its check started, and puts each one’s answer in its outcome.
resolve_pending_within 🔒
spawn_watch 🔒
Watches block_id until it can work, then sends what is kept, oldest first.
take_all 🔒
Takes everything kept for block_id.
watch 🔒
The watcher: looks every fast for fast_for, then every slow, and when holding says the agent can work, sends what is kept through deliver and answers each sender still waiting. Ends when nothing is kept for block_id.