chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import type { HealthSummary } from "../commands/health.js";
|
||||
import {
|
||||
abortChatRunById,
|
||||
type ChatAbortControllerEntry,
|
||||
} from "./chat-abort.js";
|
||||
import { abortChatRunById, type ChatAbortControllerEntry } from "./chat-abort.js";
|
||||
import { setBroadcastHealthUpdate } from "./server/health-state.js";
|
||||
import type { ChatRunEntry } from "./server-chat.js";
|
||||
import {
|
||||
@@ -26,9 +23,7 @@ export function startGatewayMaintenanceTimers(params: {
|
||||
bridgeSendToAllSubscribed: (event: string, payload: unknown) => void;
|
||||
getPresenceVersion: () => number;
|
||||
getHealthVersion: () => number;
|
||||
refreshGatewayHealthSnapshot: (opts?: {
|
||||
probe?: boolean;
|
||||
}) => Promise<HealthSummary>;
|
||||
refreshGatewayHealthSnapshot: (opts?: { probe?: boolean }) => Promise<HealthSummary>;
|
||||
logHealth: { error: (msg: string) => void };
|
||||
dedupe: Map<string, DedupeEntry>;
|
||||
chatAbortControllers: Map<string, ChatAbortControllerEntry>;
|
||||
@@ -41,11 +36,7 @@ export function startGatewayMaintenanceTimers(params: {
|
||||
sessionKey?: string,
|
||||
) => ChatRunEntry | undefined;
|
||||
agentRunSeq: Map<string, number>;
|
||||
bridgeSendToSession: (
|
||||
sessionKey: string,
|
||||
event: string,
|
||||
payload: unknown,
|
||||
) => void;
|
||||
bridgeSendToSession: (sessionKey: string, event: string, payload: unknown) => void;
|
||||
}): {
|
||||
tickInterval: ReturnType<typeof setInterval>;
|
||||
healthInterval: ReturnType<typeof setInterval>;
|
||||
@@ -72,17 +63,13 @@ export function startGatewayMaintenanceTimers(params: {
|
||||
const healthInterval = setInterval(() => {
|
||||
void params
|
||||
.refreshGatewayHealthSnapshot({ probe: true })
|
||||
.catch((err) =>
|
||||
params.logHealth.error(`refresh failed: ${formatError(err)}`),
|
||||
);
|
||||
.catch((err) => params.logHealth.error(`refresh failed: ${formatError(err)}`));
|
||||
}, HEALTH_REFRESH_INTERVAL_MS);
|
||||
|
||||
// Prime cache so first client gets a snapshot without waiting.
|
||||
void params
|
||||
.refreshGatewayHealthSnapshot({ probe: true })
|
||||
.catch((err) =>
|
||||
params.logHealth.error(`initial refresh failed: ${formatError(err)}`),
|
||||
);
|
||||
.catch((err) => params.logHealth.error(`initial refresh failed: ${formatError(err)}`));
|
||||
|
||||
// dedupe cache cleanup
|
||||
const dedupeCleanup = setInterval(() => {
|
||||
@@ -91,9 +78,7 @@ export function startGatewayMaintenanceTimers(params: {
|
||||
if (now - v.ts > DEDUPE_TTL_MS) params.dedupe.delete(k);
|
||||
}
|
||||
if (params.dedupe.size > DEDUPE_MAX) {
|
||||
const entries = [...params.dedupe.entries()].sort(
|
||||
(a, b) => a[1].ts - b[1].ts,
|
||||
);
|
||||
const entries = [...params.dedupe.entries()].sort((a, b) => a[1].ts - b[1].ts);
|
||||
for (let i = 0; i < params.dedupe.size - DEDUPE_MAX; i++) {
|
||||
params.dedupe.delete(entries[i][0]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user