The value of the key, computed at most once per ttlMs. Past that the stale value is still returned for up to staleMs while a fresh one is computed in the background.
exportinterfaceSqPlay {
source: "SQ";
at: number;
matchId: number;
season: number;
ordinal: number;
/** Before this set, also counting tournaments of the season. `null` when this set was the first. */
previousOrdinal: number | null;
isWin: boolean;
ownTier: FeedTier | null;
opponentTier: FeedTier | null;
}
The feed events of one user's whole play history (SendouQ sets and tournaments) within each type's retention. Of every type but tournament results only the latest is kept, the only one a feed item shows. The history must be complete since comebacks, first times, milestones and streaks look at the plays before.
Re-derives the feed events of everyone who finished a SendouQ set or a tournament since the last run and drops the events past retention. The first run indexes everyone who played within retention. Yields to the event loop between users so a big backlog doesn't stall requests.
Id of a feed post: its type, when it happened and a hash of who it's about. Comments and reactions are attached to it, so it stays the same for as long as the post shows the same thing.
exportinterfaceFeedContext {
mode: FeedMode;
viewerId: number;
friendIds: number[];
friendIdSet: Set<number>;
/** Users sharing a current team with the viewer who aren't their friends */
teammateIds: number[];
teammateIdSet: Set<number>;
/** Weapons of the viewer's weapon pool, see `RankableItem.weaponSplIds` */
weaponPool: MainWeaponId[];
/** Database timestamp everything is relative to */
now: number;
season: number | null;
previousSeason: number | null;
/** Queries several items of the same request share, by key */
memo: Map<string, Promise<unknown>>;
}
Builds the items of every type that has matching rows, as seen by the viewer of the context. A builder that throws is logged and skipped so one broken query doesn't take the page down.
How well another LFG post fits the viewer's own, 0–1: timezone closeness weighted by FEED_LFG_TIMEZONE_WEIGHT, skill closeness by the rest. null when it doesn't fit well enough to show (below FEED_LFG_MIN_MATCH) or both posts list languages but none in common.
exportfunctionmatch(
own: LfgPostProfile,
other: LfgPostProfile,
): number | null
How well a tournament team's level fits the viewer's, 0–1: the skill part of match alone, since the tournament fixes the time. null below FEED_LFG_MIN_MATCH.
exportfunctionlevelMatch(
ownTierRank: number | null,
otherTierRank: number | null,
): number | null
Everything a feed page shows: the viewer's posts in order with their comment and reaction counts as userId sees them.
exportasyncfunctionload({
viewerId,
userId,
mode,
isScoreShown,
}: {
viewerId: number;
/** The logged in user, differs from `viewerId` when a dev views someone else's feed */
userId: number;
mode: FeedItems.FeedMode;
/** Whether each post's ranking score breakdown is included */
isScoreShown: boolean;
})
exportinterfaceRankableItem {
type: FeedItemType;
/** Database timestamp (seconds) of when the item happened */
at: number;
/** Who the item is about, used to stop one person taking over the feed */
actorKey: string;
/** How the viewer knows who the item is about, `null` when it isn't about someone they know */
relation: FeedRelation | null;
/** How strong the item is among those of its type, 0–1, 1 when left out */
weight?: number;
/** Weapons the item is about, matched against the viewer's weapon pool */
weaponSplIds?: MainWeaponId[];
}
Score of an item before the diversity pass: base score of its type × the item's weight × affinity × weapon affinity × exponential recency decay by the type's half-life. Affinity is that of the item's relation, or without one the widest audience of its type.
Orders items by score with a greedy diversity pass: each pick is penalized if its category appeared in the previous two picks or its actor in the previous four, and once more for each earlier pick of its type.
The tournament showcase post live at now: Monday morning's covers the weekdays until Friday morning, Friday morning's the weekend until Monday morning.
Why a scrim post is shown to a member of teams with the profiles, null when it isn't. Fit needs a usual scrim hour and a div within FEED_SCRIM_FIT_MAX_DIV_GAP of the post's range.
What a player can still reach before the season ends: the sets they're short of getting ranked or, once ranked, the next tier when it's at most FEED_SEASON_ENDING_MAX_SP_SHORT away. null when neither applies.
exportfunctionseasonEndGoal({
matchesCount,
ordinal,
intervals,
}: {
matchesCount: number;
ordinal: number;
/** Tiers of the season, highest first, see `SkillTierInterval` */
intervals: Array<FeedTier & { neededOrdinal?: number }>;
}): SeasonGoal | null
Weapons whose share of play rose and fell the most from last week to this week. Every player's weapon mix counts once, weighted from 1 (lowest ranked or unranked) to TOP_PLAYER_WEIGHT (highest ranked) by their ordinal among the week's players. null when either week has too few players or there is no clear riser and faller.
exportfunctionrisersAndFallers({
thisWeek,
lastWeek,
ordinals,
}: {
thisWeek: WeaponPicks[];
lastWeek: WeaponPicks[];
/** Skill ordinal by user id */
ordinals: Map<number, number>;
})