Skip to main content

Module sisu_day_gap

Module sisu_day_gap 

Source
Expand description

The nightly hours when Finland is already on the next day but Sisu, which dates attainments by the UTC day, is not: 00:00–03:00 Finnish time in summer, 00:00–02:00 in winter. Suotar dates an attainment by its Finnish day, so one dated today is in the future for Sisu then, and Sisu refuses it. Importing waits the gap out.

Constants§

SISU_DAY_GAP_LEAD 🔒
The gap starts this long before Finnish midnight, so a batch claimed just before it reaches Sisu in time.
SISU_DAY_GAP_SPREAD 🔒
How long after the gap the imports it held back are spread over, so they do not all reach Suotar the moment it ends.
SISU_DAY_GAP_TAIL 🔒
The gap ends this long after UTC midnight, for clock differences between us, Suotar and Sisu.

Functions§

current_gap_end
When the gap we are in ends, or None outside it. Read off the database’s clock and time zone data, which knows when Finland changes to and from summer time.
spread_imports_past_gap
Moves every import due before gap_end to a random moment in the SISU_DAY_GAP_SPREAD after it. A moved row is no longer due before gap_end, so running this on every tick of the gap moves each row once. Returns how many rows moved.