asobi_quests_period (asobi_quests v0.2.2)
View SourceWhich window a quest counts in, and the key that names it.
Three periods. none counts forever and keys every row all; daily and
weekly cut the count at a UTC boundary and key the row by the window it
falls in, so a new window simply finds no row and starts at zero. Nothing has
to run at midnight for a daily quest to reset - the key changing is the reset.
UTC, not a per-deployment timezone. A rollover boundary that moves with a configuration change would silently hand every player a second daily reward on the day it moved.
Summary
Functions
The keys of every window of Period that closed more than Days ago, from
the perspective of Seconds.
The period key for Period right now.
The period key for Period at Seconds (a UTC POSIX timestamp).
The periods a quest definition may declare.
Types
-type period() :: binary().
Functions
-spec expired_before(period(), non_neg_integer(), integer()) -> [binary()].
The keys of every window of Period that closed more than Days ago, from
the perspective of Seconds.
Used by the rollover worker to delete progress nobody can advance or claim any
more. Returned as a bounded list of exact keys rather than a < comparison,
because the keys of two periods do not sort against each other:
2026-W01 is lexically less than 2026-01-05, so a single string
inequality over the whole table would delete live weekly rows.
The period key for Period right now.
The period key for Period at Seconds (a UTC POSIX timestamp).
daily is YYYY-MM-DD; weekly is YYYY-Www on the ISO-8601 week, which is
the only week numbering where the key of a Monday and the key of the following
Sunday agree.
-spec periods() -> [period(), ...].
The periods a quest definition may declare.