Skip to content

Background work

What the server does without a user clicking anything, and what it is called by apart from the browser. Generated from the cron schedules of app/entry.server.tsx, the routines of app/routines/, the routes of app/routes.ts and the Notification type.

Scheduled routines

31 routines run by node-cron, in production only (the e2e tests and development never start the schedules). A schedule runs its routines one after another, a routine failing is logged and doesn't stop the rest. In development or an e2e test run a routine can be run by hand by POST /run-routine with its name (run-routine.ts).

Every hour at :00

0 */1 * * * in the server's time zone, runs everyHourAt00 entry.server.tsx

NotifySeasonStart

SEASON_STARTEDnotifySeasonStart.ts

No description, add JSDoc to NotifySeasonStartRoutine.

5 tables · 3 written

NotifyPlusServerVoting

PLUS_VOTING_STARTEDnotifyPlusServerVoting.ts

No description, add JSDoc to NotifyPlusServerVotingRoutine.

5 tables · 3 written

NotifyCheckInStart

TO_CHECK_IN_OPENEDnotifyCheckInStart.ts

No description, add JSDoc to NotifyCheckInStartRoutine.

26 tables · 3 written

NotifyScrimStartingSoon

SCRIM_STARTING_SOONnotifyScrimStartingSoon.ts

No description, add JSDoc to NotifyScrimStartingSoonRoutine.

12 tables · 3 written

NotifyLeagueMatchStartingSoon

TO_LEAGUE_MATCH_STARTING_SOONnotifyLeagueMatchStartingSoon.ts

No description, add JSDoc to NotifyLeagueMatchStartingSoonRoutine.

8 tables · 3 written

SyncTournamentVods

syncTournamentVods.ts

No description, add JSDoc to SyncTournamentVodsRoutine.

11 tables · 2 written

Every hour at :30

30 */1 * * * in the server's time zone, runs everyHourAt30 entry.server.tsx

SetOldGroupsAsInactive

setOldGroupsAsInactive.ts

No description, add JSDoc to SetOldGroupsAsInactiveRoutine.

11 tables · 3 written

ResolveStaleSQMatches

resolveStaleSQMatches.ts

No description, add JSDoc to ResolveStaleSQMatchesRoutine.

24 tables · 10 written

Every day at 04:00

0 4 * * * in the server's time zone, runs daily entry.server.tsx

4:00 AM UTC

NotifySeasonEnd

SEASON_ENDEDnotifySeasonEnd.ts

No description, add JSDoc to NotifySeasonEndRoutine.

5 tables · 3 written

NotifyScheduleTeamReminder

SCHEDULE_TEAM_REMINDERnotifyScheduleTeamReminder.ts

Reminds users whose teammates reported the week that just started while they have not. Mondays only, so at most one reminder per week.

6 tables · 3 written

OptimizeDatabase

optimizeDatabase.ts

No description, add JSDoc to OptimizeDatabaseRoutine.

0 tables
  • no database access

Every Wednesday at 09:00

0 9 * * 3 in Europe/Helsinki, runs weekly entry.server.tsx

9:00 AM Finnish time on Wednesdays, a quiet hour since vacuuming blocks writes longer than the 5s busy_timeout

VacuumDatabase

vacuumDatabase.ts

Rewrites the database file to reclaim fragmentation, mostly from migrations that drop a wide column or a large index (ordinary traffic keeps the freelist in single digit MB, so most weeks this skips). Readers keep the pre-vacuum WAL snapshot but writers block for the whole rewrite, longer than the 5s busy_timeout, hence a quiet hour and weekly rather than daily.

0 tables
  • no database access

Every 2 minutes

*/2 * * * * in the server's time zone, runs everyTwoMinutes entry.server.tsx

Endpoints for machines

Routes with no page that other services or the dev tools call: found by their path containing webhook, or by their loader (GET) or action (POST) checking the caller with canAccessLohiEndpoint or guarding on DANGEROUS_CAN_ACCESS_DEV_CONTROLS.

Lohi

Called by Lohi, the sendou.ink Discord bot, with the LOHI_TOKEN environment variable in the Lohi-Token header (canAccessLohiEndpoint).

Webhooks

Called by third parties when something happens on their side, each verifying the request's signature.

Dev controls

Only answer in development and e2e test runs (DANGEROUS_CAN_ACCESS_DEV_CONTROLS), called by the dev tools and the e2e helpers.

POST

/refresh-caches

refresh-caches.ts
Action: 33 tables · 1 written
POST

/seed

seed.ts
Action: 33 tables · 1 written

Discord webhooks

Messages posted to Discord channels, from app/modules/discord-webhook.server.ts. Each channel's webhook URL is an environment variable, the message is skipped when it is unset.

Notification types

The members of the Notification union (notifications-types.ts), sent with notify(): shown in the notifications list and, after a grace period in which seeing it cancels it, pushed to subscribed devices. Title and text are the English translations of notifications.title.* and notifications.text.* in locales/en/common.json, interpolating the meta.

SQ_READY_CHECK

highnotifications-types.ts

Ready Check Confirm you are ready to play

Links to
SENDOUQ_READY_PAGE
Sent by
start ready-check.server.ts

SQ_NEW_MATCH

highnotifications-types.ts

New SendouQ Match SendouQ match #{{matchId}} started

Meta
matchId: number
Links to
sendouQMatchPage(notification.meta.matchId)
Sent by
createMatch ready-check.server.ts

TO_ADDED_TO_TEAM

notifications-types.ts

Added to Team Added to a team ({{teamName}}) by {{adderUsername}} in {{tournamentName}}

Meta
tournamentId: number, tournamentName: string, adderUsername: string, teamName: string, tournamentTeamId: number
Links to
tournamentTeamPage({ tournamentId: notification.meta.tournamentId, tournamentTeamId: notification.meta.tournamentTeamId })
Sent by

TO_BRACKET_STARTED

highnotifications-types.ts

Bracket Started {{bracketName}} of {{tournamentName}} started

Meta
tournamentId: number, bracketIdx: number, bracketName: string, tournamentName: string
Links to
tournamentBracketsPage({ tournamentId: notification.meta.tournamentId, bracketIdx: notification.meta.bracketIdx })
Sent by

TO_CHECK_IN_OPENED

highnotifications-types.ts

Check-in Opened Check-in for {{tournamentName}} open

Meta
tournamentId: number, tournamentName: string
Links to
tournamentRegisterPage(notification.meta.tournamentId)
Sent by

TO_TEST_CREATED

notifications-types.ts

Test tournament created You created a test tournament {{tournamentName}}

Meta
tournamentId: number, tournamentName: string
Links to
tournamentRegisterPage(notification.meta.tournamentId)
Sent by

BADGE_MANAGER_ADDED

notifications-types.ts

Manager Rights Granted You got manager rights for badge {{badgeName}}

Meta
badgeName: string, badgeId: number
Links to
badgePage(notification.meta.badgeId)
Sent by

TROPHY_SUBMISSION_ACCEPTED

notifications-types.ts

Trophy Accepted Your trophy {{trophyName}} was accepted

Meta
trophyName: string, trophyId: number
Links to
trophyPage(notification.meta.trophyId)
Sent by

TAGGED_TO_ART

notifications-types.ts

Tagged in Art Tagged in art by {{adderUsername}}

Meta
adderUsername: string, adderId: number, artId: number
Links to
userArtPage({ id: notification.meta.adderId }, "MADE-BY", notification.meta.artId)
Sent by

SEASON_ENDED

notifications-types.ts

Season Ended Thanks for playing Season {{seasonNth}}! Export your season summary while it's available

Meta
seasonNth: number
Links to
recipient ? userSeasonsPage({ user: recipient, season: notification.meta.seasonNth }) : SENDOUQ_PAGE
Sent by

SCRIM_NEW_REQUEST

highnotifications-types.ts

New Scrim Request {{fromUsername}} requested a scrim

Meta
fromUserId: number, fromUsername: string, scrimPostId: number
Links to
scrimsPage()
Sent by

SCRIM_SCHEDULED

highnotifications-types.ts

Scrim Scheduled New scrim scheduled vs. {{opponentTeamName}}

Meta
id: number, opponentTeamName: string
Links to
scrimPage(notification.meta.id)
Sent by

SCRIM_CANCELED

highnotifications-types.ts

Scrim Canceled The scrim vs. {{opponentTeamName}} was canceled

Meta
id: number, opponentTeamName: string
Links to
scrimPage(notification.meta.id)
Sent by

SCRIM_STARTING_SOON

highnotifications-types.ts

Scrim Starting Soon Your scrim vs. {{opponentTeamName}} is starting soon

Meta
id: number, opponentTeamName: string
Links to
scrimPage(notification.meta.id)
Sent by

TO_LEAGUE_TIMES_PROPOSED

highnotifications-types.ts

League Times Proposed {{opponentTeamName}} proposed times for your league set

Meta
tournamentId: number, matchId: number, opponentTeamName: string
Links to
tournamentMatchPage({ tournamentId: notification.meta.tournamentId, matchId: notification.meta.matchId })
Sent by

TO_LEAGUE_MATCH_SCHEDULED

highnotifications-types.ts

League Set Scheduled Your league set vs. {{opponentTeamName}} has been scheduled

Meta
tournamentId: number, matchId: number, opponentTeamName: string
Links to
tournamentMatchPage({ tournamentId: notification.meta.tournamentId, matchId: notification.meta.matchId })
Sent by

TO_LEAGUE_MATCH_STARTING_SOON

highnotifications-types.ts

League Set Starting Soon Your league set vs. {{opponentTeamName}} is starting soon

Meta
tournamentId: number, matchId: number, opponentTeamName: string
Links to
tournamentMatchPage({ tournamentId: notification.meta.tournamentId, matchId: notification.meta.matchId })
Sent by

SCRIM_AUTO_DELETED

notifications-types.ts

Scrim Post Removed Your scrim post was automatically removed because you booked a scrim around that time (± 1 hour)

Meta
at: number
Links to
scrimsPage()
Sent by

FRIEND_REQUEST_RECEIVED

notifications-types.ts

Friend Request {{senderUsername}} sent you a friend request

Meta
senderId: number, senderUsername: string
Links to
FRIENDS_PAGE
Sent by

TO_LIKE_RECEIVED

highnotifications-types.ts

Group Invitation Received {{likerUsername}} invited your group in {{tournamentName}}

Meta
tournamentId: number, tournamentName: string, likerUsername: string
Links to
tournamentSubsPage(notification.meta.tournamentId)
Sent by

TO_LIKE_ACCEPTED

highnotifications-types.ts

Group Invitation Accepted {{accepterUsername}} accepted your group invitation in {{tournamentName}}

Meta
tournamentId: number, tournamentName: string, accepterUsername: string
Links to
tournamentSubsPage(notification.meta.tournamentId)
Sent by

TEAM_EVENT_ADDED

notifications-types.ts

New Team Event {{teamName}} has a new event: {{eventName}}

Meta
eventName: string, teamName: string, teamCustomUrl: string
Links to
teamSchedulePage(notification.meta.teamCustomUrl)
Sent by

CHAT_MENTION

highnotifications-types.ts

Mentioned in Chat {{mentionerUsername}} mentioned you in chat

Meta
roomId: number, messageId: number, mentionerUsername: string, roomUrl: string
Links to
chatOpenedPage({ pageUrl: notification.meta.roomUrl, roomId: notification.meta.roomId })
Sent by
notifyMentioned ChatMentionNotification.server.ts