File size: 560 Bytes
94193b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import { TaskManager } from './task-manager';
import { SSEEventBus } from './sse-event-bus';
const g = globalThis as unknown as {
__serverGenTaskManager?: TaskManager;
__serverGenEventBus?: SSEEventBus;
};
if (!g.__serverGenTaskManager) {
g.__serverGenTaskManager = new TaskManager({
maxConcurrentPerScope: 3,
keyTTLMs: 30 * 60 * 1000,
});
}
if (!g.__serverGenEventBus) {
g.__serverGenEventBus = new SSEEventBus({ maxBufferSize: 500 });
}
export const taskManager = g.__serverGenTaskManager;
export const eventBus = g.__serverGenEventBus;
|