Skip to content

Commit 8ca704a

Browse files
committed
Admit one user per 30s
1 parent 282194a commit 8ca704a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

web/src/server/free-session/config.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ import { env } from '@codebuff/internal/env'
77
*/
88
export const FREEBUFF_ADMISSION_LOCK_ID = 573924815
99

10-
/** Admission tick cadence. Fast enough to drain the queue promptly, slow
11-
* enough to avoid DB churn. */
12-
export const ADMISSION_TICK_MS = 5_000
10+
/** Admission tick cadence. Paired with MAX_ADMITS_PER_TICK=1 this staggers
11+
* admissions so newly-admitted CLIs don't all POST to the
12+
* Fireworks deployment simultaneously. */
13+
export const ADMISSION_TICK_MS = 15_000
1314

14-
/** Max users admitted in a single tick. Protects against thundering-herd
15-
* admissions when capacity frees up all at once (e.g. after a Fireworks
16-
* incident clears). */
17-
export const MAX_ADMITS_PER_TICK = 20
15+
/** Max users admitted in a single tick. Staggering matters more than
16+
* throughput here: keeps load on Fireworks smooth even when a
17+
* large block of sessions expires at once. */
18+
export const MAX_ADMITS_PER_TICK = 1
1819

1920
export function isWaitingRoomEnabled(): boolean {
2021
return env.FREEBUFF_WAITING_ROOM_ENABLED

0 commit comments

Comments
 (0)