refactor: centralize agent concurrency defaults

This commit is contained in:
Peter Steinberger
2026-01-20 10:27:58 +00:00
parent d88b239d3c
commit 213d9b47b0
8 changed files with 79 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
import { type RunOptions, run } from "@grammyjs/runner";
import type { ClawdbotConfig } from "../config/config.js";
import { loadConfig } from "../config/config.js";
import { DEFAULT_AGENT_MAX_CONCURRENT } from "../config/agent-limits.js";
import { computeBackoff, sleepWithAbort } from "../infra/backoff.js";
import { formatDurationMs } from "../infra/format-duration.js";
import type { RuntimeEnv } from "../runtime.js";
@@ -28,7 +29,7 @@ export type MonitorTelegramOpts = {
export function createTelegramRunnerOptions(cfg: ClawdbotConfig): RunOptions<unknown> {
return {
sink: {
concurrency: cfg.agents?.defaults?.maxConcurrent ?? 1,
concurrency: cfg.agents?.defaults?.maxConcurrent ?? DEFAULT_AGENT_MAX_CONCURRENT,
},
runner: {
fetch: {