Table of contents
Token Refresh and Caching
EVE SSO access tokens live ~20 minutes. validAccessToken
(internal/app/auth_refresh.go) returns the stored token while it has more
seconds left; otherwise it refreshes against CCP and persists the new
access token, the rotated refresh token, and the new expiry.
Refreshes are serialized process-wide and the character row is
re-read first, so a rotated refresh token is never replayed.
ESI responses for skills, skill queue, wallet and assets are cached as raw
JSON in character_snapshots, keyed by
(character, kind) with the response's Expires header stored as
cached_until (5-minute fallback when ESI sends none). The module
sweep caches the character live-state endpoints the same way
(location, ship, online, clones, implants, fittings, fatigue and the
recent-killmails list). Killmail details are different: they are
immutable, so the worker warms them once per killmail into the
killmail_details store (at most 10
per character per cycle) and pages read the store only. Corporation
datasets (module sweep cluster 2) ride the
same snapshot table as corp_* kinds, fetched with each viewing
character's token against that character's corporation: so pages
follow the selected character's corp, and character/corporation ID
collisions can never cross-contaminate. Role-gated corporation
endpoints answer 403 when the character lacks the in-game role;
the worker records that in snapshot_fetch_state (state
role_missing plus the role label), backs the kind off for six
hours instead of retrying every minute, and never writes a
snapshot for a refused kind: the subpages and the Sync page
render the recorded state ("Needs the Director role in-game")
until a fetch succeeds. Corp asset singleton names come from
POST /corporations/{id}/assets/names/ (bounded to 1,000 items
per cycle, stored in item_names; CCP's "None" placeholder for
unnamed items is skipped). Assets are
paginated: every page is fetched and stored as one merged JSON array. Pages serve
fresh snapshots without calling ESI; on fetch failure a stale
snapshot is served instead of an error. ESI's error-limit statuses
(420/429) are treated as a hard back-off signal.
Refreshes are conditional where they can be. A dataset that comes
in one response is stored with the ETag ESI sent, and the next
refresh offers it back (If-None-Match). When nothing has changed
ESI answers 304 Not Modified with no body: the stored payload
stays as it is and only its cache window is renewed. Datasets
spread over several pages (assets, contracts, blueprints, …) have
an ETag per page and none for the whole, so they are downloaded in
full each time. evesynapse -refresh clears the stored ETags, so
everything really is downloaded again.
Name resolution is split in two tiers. Page renders resolve type,
group and place names from local data only (the in-process maps,
the SDE static-data tables (see Static Data), and the type_names fallback
table) a render never waits on ESI; anything still missing shows
as Type #<id> (or an "Ungrouped" skill section) until the
worker's warm-up pass fills it in. The interactive Market lookup
is the one exception: it may make a single name fetch for an item
nobody has cached yet.
The Intel cluster (module sweep cluster 4) is public ESI data (wars, incursions, faction
warfare and Tranquility status) so it doesn't ride the
per-character snapshot table. The worker keeps it in a small
global store instead: global_snapshots (one raw payload per
dataset, same Expires/cached_until contract) plus a
war_details store for GET /wars/{war_id}/ payloads, warmed
newest-first at most 50 per cycle and refreshed while a war is
active (finished wars are immutable). War-party corporation and
alliance names and incursion constellation names warm into
in-process caches through the worker cycle's shared lookup
budget; faction names come from the stored factions list itself.
The Intel pages and the Home page's Tranquility line render from
the store only: and the worker pass runs even with no characters
linked, since none of it needs a token.