From bc7981f6b96cb942bc45e5c4475b8f03381f5cc2 Mon Sep 17 00:00:00 2001 From: Artem Rootman <4586640+artemrootman@users.noreply.github.com> Date: Sun, 5 Apr 2026 18:09:59 +0000 Subject: [PATCH] fix: use full intervals content in worker cache key, not just length Two different interval sets with the same length would produce the same cache key, returning stale results. Serialize each interval's startedAt~completedAt into the key. --- src/main/workers/team-data-worker.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/workers/team-data-worker.ts b/src/main/workers/team-data-worker.ts index 4b91fdf1..06fa12c2 100644 --- a/src/main/workers/team-data-worker.ts +++ b/src/main/workers/team-data-worker.ts @@ -44,7 +44,10 @@ parentPort?.on('message', async (msg: TeamDataWorkerRequest) => { } case 'findLogsForTask': { const { teamName, taskId, options } = msg.payload; - const cacheKey = `${teamName}:${taskId}:${options?.owner ?? ''}:${options?.status ?? ''}:${options?.since ?? ''}:${options?.intervals?.length ?? 0}`; + const intervalsKey = options?.intervals + ? options.intervals.map((i) => `${i.startedAt}~${i.completedAt ?? ''}`).join(',') + : ''; + const cacheKey = `${teamName}:${taskId}:${options?.owner ?? ''}:${options?.status ?? ''}:${options?.since ?? ''}:${intervalsKey}`; // Check result cache const cached = logsResultCache.get(cacheKey);