11import type { ScheduledTaskId , ThreadId } from "@t3tools/contracts" ;
2- import * as Config from "effect/Config" ;
32import * as Context from "effect/Context" ;
43import * as DateTime from "effect/DateTime" ;
54import * as Duration from "effect/Duration" ;
@@ -17,24 +16,18 @@ import * as ServerSettings from "../serverSettings.ts";
1716/** Work due this soon keeps the window closed, so it does not start late. */
1817const UPDATE_LOOKAHEAD = Duration . minutes ( 5 ) ;
1918
20- /**
21- * Background update pacing. `T3CODE_UPDATE_LAB=1` (scripts/update-lab.ts)
22- * shortens the waits so update flows can be exercised in seconds.
23- */
24- export const updateTimings = Config . Boolean ( "T3CODE_UPDATE_LAB" ) . pipe (
25- Config . withDefault ( false ) ,
26- Config . map ( ( lab ) => ( {
27- /**
28- * How long every client must be untouched before an update may interrupt
29- * it. Clients report activity about every 25s, so this must stay well above that.
30- */
31- quietPeriod : lab ? Duration . seconds ( 60 ) : Duration . minutes ( 15 ) ,
32- /** How often a waiting update rechecks the window or looks for new versions. */
33- recheck : lab ? Duration . seconds ( 5 ) : Duration . seconds ( 30 ) ,
34- firstPassDelay : lab ? Duration . seconds ( 10 ) : Duration . minutes ( 2 ) ,
35- passInterval : lab ? Duration . seconds ( 20 ) : Duration . minutes ( 10 ) ,
36- } ) ) ,
37- ) ;
19+ /** Background update pacing. */
20+ export const updateTimings = Effect . succeed ( {
21+ /**
22+ * How long every client must be untouched before an update may interrupt
23+ * it. Clients report activity about every 25s, so this must stay well above that.
24+ */
25+ quietPeriod : Duration . minutes ( 15 ) ,
26+ /** How often a waiting update rechecks the window or looks for new versions. */
27+ recheck : Duration . seconds ( 30 ) ,
28+ firstPassDelay : Duration . minutes ( 2 ) ,
29+ passInterval : Duration . minutes ( 10 ) ,
30+ } ) ;
3831
3932export type UpdateWindowBlocker =
4033 | { readonly type : "active-threads" ; readonly threadIds : ReadonlyArray < ThreadId > }
0 commit comments