mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-18 21:22:28 +03:00
Family resolves like auto/zai with no connected models logged a warn on every call (about once a minute per poll). Keep the empty-pool behavior; emit the warn at most once per label per 60s. Co-authored-by: Ravi Tharuma <RaviTharuma@users.noreply.github.com> Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
19 lines
818 B
TypeScript
19 lines
818 B
TypeScript
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
|
|
import {
|
|
EMPTY_POOL_WARN_INTERVAL_MS,
|
|
resetEmptyAutoPoolWarnStateForTests,
|
|
warnEmptyAutoPoolOnce,
|
|
} from "../../open-sse/services/autoCombo/virtualFactory.ts";
|
|
|
|
test("warnEmptyAutoPoolOnce emits at most once per label per interval", () => {
|
|
resetEmptyAutoPoolWarnStateForTests();
|
|
const t0 = 1_000_000;
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0), true);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0 + 1), false);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0 + EMPTY_POOL_WARN_INTERVAL_MS - 1), false);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/other", "empty", t0 + 1), true);
|
|
assert.equal(warnEmptyAutoPoolOnce("auto/zai", "empty", t0 + EMPTY_POOL_WARN_INTERVAL_MS), true);
|
|
});
|