Expand description
When enrolment discovery fetches each course code’s enrolment list.
A code is due weekly, and sooner while somebody on its modules waits for a student number: each
such person is on the ladders of the signals they have given that they are enrolling, and the
code is due at the earliest rung no fetch that could claim linking mail has served. Every due
time snaps up to the code’s own grid, see fetch_slot, so codes spread evenly over the hour.
Both are derived whenever they are needed; the table keeps only what cannot be: when fetches
ran, the failure backoff and how many fetches of the code went out today.
Modules§
- testing
- Test-mode setup the system tests drive through the mock Suotar control routes.
Structs§
- Account
Linking Code Counters - What one code’s last enrolment list that fed account linking did, each person counted once in
exactly one of the counters after
listed_person_count. Written whole, so the dashboard never mixes two runs. - Code
Waiting 🔒 - The people waiting on one code; see
RosterSchedule. - Failing
Roster Code - Codes listed on their own that keep failing, for the admin alert.
- Roster
Schedule - One code’s schedule, with the waiting people its next fetch is derived from.
Enums§
- Schedule
Selection - Which codes
get_schedulesreads.
Constants§
- ALONE_
FAILURE_ 🔒BACKOFF_ SECS - How long a code that failed on its own is left alone, by how many times in a row it has.
- BASELINE_
INTERVAL - How often every code is fetched, whether or not anybody on it is waiting.
- FETCH_
GRID_ STEP - How far apart the points of a code’s fetch grid are. Divides an hour.
- MAX_
FETCHES_ PER_ DAY - How many fetches of one code may go out in a UTC day. Past it, only the weekly fetch and an admin’s request make the code due: a third of the grid points, so one busy code cannot crowd out the rest.
- MIN_
REFETCH_ GAP - A code fetched this recently is not fetched again, whatever is due.
- PRESSED_
LADDER 🔒 - PRESS_
MIN_ REFETCH_ GAP - The shorter gap the first fetch after an “I have enrolled” press or an admin’s request needs, since somebody is waiting on it.
- VISITED_
LADDER 🔒 - WAITING_
HORIZON - How long after its anchor a waiting person still makes the code due: every ladder ends here.
- WAITING_
HORIZON_ 🔒SECS
Functions§
- ensure_
rows - Creates the schedule rows of every listable code, and the per-module configuration rows the
listing status is written to.
course_idnarrows it to one course. - fetch_
slot - The first point of
course_code’s fetch grid at or afterat:FETCH_GRID_STEPapart, at an offset into the step fixed per code. The only place that decides when within the hour a code goes out. - get_
failing_ codes - The codes whose latest listings failed, most consecutive failures first.
- get_
modules_ by_ code - The active modules on each of
course_codes, which share its roster.course_idnarrows them to one course, as it does forget_schedules. - get_
schedules - Every listable code that has a schedule row; see
ensure_rows.course_idnarrows the codes and the modules their waiting people come from to one course, for a scoped tick. Only completions on or afteraccount_linking_sincecan wait, and with itNonenobody does. - get_
waiting 🔒 - The people waiting on each code, their rungs and presses counted after the code’s
served_until. - mark_
alone_ failed - Records a listing of the code on its own that failed, and backs the code off: an hour, four hours, then daily.
- mark_
attempted - Stamps the codes a listing request is about to go out for and counts the fetch against
MAX_FETCHES_PER_DAY. Returns the stamp to hand tomark_fetched. - mark_
batch_ failed - Records a request batching several codes that failed as a whole. Each is listed on its own from now on, until it succeeds, so one bad code stops failing the others.
- mark_
fetched - Records an enrolment list that arrived, or Suotar saying it holds no realisation of the code,
and clears the failure streak.
started_atis whatmark_attemptedreturned for the request, andcould_claim_mailwhether the list was free to claim linking mail; only such a fetch serves the waiting people’s rungs and presses. Returns when the code was fetched before this. - record_
linking_ counters - Overwrites the code’s linking counters with what its latest enrolment list did.
unlinked_enrolled_before_countcounts the people the list held outside the counters: enrolled before account linking began, and linked to no account. - request_
fetch - Makes the code due at its next grid point, past
MAX_FETCHES_PER_DAY. Returns the schedule row’s id, orNonefor a code with no row.