Skip to content

Commit 38f6fdf

Browse files
committed
chore(logs): silence models-dev-cache log on unchanged refreshes
The periodic 5-minute API refresh was logging 'models-dev-cache: API layer loaded N model limits' on every tick, even when the model count was identical to the previous load. Log only on first successful load or when the count changes, so the common no-op refresh stays quiet.
1 parent 1d22634 commit 38f6fdf

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

packages/plugin/src/shared/models-dev-cache.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,19 @@ export async function refreshModelLimitsFromApi(client: OpencodeClient): Promise
237237
}
238238
}
239239

240+
const previousSize = apiCache?.size ?? null;
240241
apiCache = map;
241242
apiLoadedAt = Date.now();
242-
sessionLog("global", `models-dev-cache: API layer loaded ${map.size} model limits`);
243+
// Log only on first successful load or when the model count changes,
244+
// so the 5-minute periodic refresh doesn't spam the log.
245+
if (previousSize === null || previousSize !== map.size) {
246+
sessionLog(
247+
"global",
248+
`models-dev-cache: API layer loaded ${map.size} model limits${
249+
previousSize !== null ? ` (was ${previousSize})` : ""
250+
}`,
251+
);
252+
}
243253
} catch (error) {
244254
sessionLog(
245255
"global",

0 commit comments

Comments
 (0)