refactor(server): share one keyed lock that releases idle keys (#15577)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Julius MarmingeandClaude Opus 5.5 authored and GitHub committed 2026-10-04 21:31:52 -07:00
1 parent 1beb0355d0
commit 37de6cbde6
14 files changed
+190 -196

No files matched your search

@@ -1,13 +1,12 @@
import type { ThreadId } from "@t3tools/contracts";
import * as KeyedLock from "@t3tools/shared/KeyedLock";
import * as Context from "effect/Context";
import * as Layer from "effect/Layer";
import { makeKeyedSerialExecutor, type KeyedSerialExecutor } from "./KeyedSerialExecutor.ts";
/** Shared by thread commands and project deletion so both plan against current thread state. */
export class ThreadCommandExecutor extends Context.Service<
ThreadCommandExecutor,
KeyedSerialExecutor<ThreadId>
KeyedLock.KeyedLock<ThreadId>
>()("t3/orchestration-v2/ThreadCommandExecutor") {}
export const layer = Layer.effect(ThreadCommandExecutor, makeKeyedSerialExecutor<ThreadId>());
export const layer = Layer.effect(ThreadCommandExecutor, KeyedLock.make<ThreadId>());