File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,8 @@ import { registerRunChangeNotifierHandlers } from "./services/realtime/runChange
4343import { sessionsReplicationInstance } from "./services/sessionsReplicationInstance.server" ;
4444( globalThis as Record < string , unknown > ) . __sessionsReplicationInstance =
4545 sessionsReplicationInstance ;
46+ import { globalFlagsRegistry } from "./v3/globalFlagsRegistry.server" ;
47+ ( globalThis as Record < string , unknown > ) . __globalFlagsRegistry = globalFlagsRegistry ;
4648
4749const ABORT_DELAY = 30000 ;
4850
Original file line number Diff line number Diff line change 1+ import { singleton } from "~/utils/singleton" ;
2+ import { env } from "~/env.server" ;
3+ import { flags } from "~/v3/featureFlags.server" ;
4+ import type { FeatureFlagCatalog } from "~/v3/featureFlags" ;
5+ import { createReloadingRegistry } from "~/utils/reloadingRegistry.server" ;
6+
7+ /**
8+ * In-memory snapshot of the global feature flags, refreshed every
9+ * GLOBAL_FLAGS_RELOAD_INTERVAL_MS. `flags()` reads the DB-backed global values
10+ * (no per-org overrides). Read synchronously on the trigger hot path; callers
11+ * gate the first read on `waitUntilReady`.
12+ */
13+ export const globalFlagsRegistry = singleton ( "globalFlagsRegistry" , ( ) =>
14+ createReloadingRegistry < Partial < FeatureFlagCatalog > > ( {
15+ name : "global-flags" ,
16+ intervalMs : env . GLOBAL_FLAGS_RELOAD_INTERVAL_MS ,
17+ load : ( ) => flags ( ) ,
18+ } )
19+ ) ;
You can’t perform that action at this time.
0 commit comments