Merge pull request #112 from laurentenhoor/fix/108-stale-worker-duration
fix: reset startTime on task assignment for accurate duration tracking
This commit is contained in:
@@ -244,12 +244,13 @@ async function recordWorkerState(
|
|||||||
workspaceDir: string, groupId: string, role: "dev" | "qa",
|
workspaceDir: string, groupId: string, role: "dev" | "qa",
|
||||||
opts: { issueId: number; tier: string; sessionKey: string; sessionAction: "spawn" | "send" },
|
opts: { issueId: number; tier: string; sessionKey: string; sessionAction: "spawn" | "send" },
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const params: { issueId: string; tier: string; sessionKey?: string; startTime?: string } = {
|
const params: { issueId: string; tier: string; sessionKey?: string; startTime: string } = {
|
||||||
issueId: String(opts.issueId), tier: opts.tier,
|
issueId: String(opts.issueId),
|
||||||
|
tier: opts.tier,
|
||||||
|
startTime: new Date().toISOString(), // Always reset startTime for new task assignment
|
||||||
};
|
};
|
||||||
if (opts.sessionAction === "spawn") {
|
if (opts.sessionAction === "spawn") {
|
||||||
params.sessionKey = opts.sessionKey;
|
params.sessionKey = opts.sessionKey;
|
||||||
params.startTime = new Date().toISOString();
|
|
||||||
}
|
}
|
||||||
await activateWorker(workspaceDir, groupId, role, params);
|
await activateWorker(workspaceDir, groupId, role, params);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user