Merge pull request #114 from laurentenhoor/fix/113-starttime-update
fix: clear startTime when deactivating workers to prevent stale timestamps
This commit is contained in:
@@ -230,6 +230,7 @@ export async function activateWorker(
|
||||
/**
|
||||
* Mark a worker as inactive after task completion.
|
||||
* Preserves sessions map and tier for reuse via updateWorker's spread.
|
||||
* Clears startTime to prevent stale timestamps on inactive workers.
|
||||
*/
|
||||
export async function deactivateWorker(
|
||||
workspaceDir: string,
|
||||
@@ -239,6 +240,7 @@ export async function deactivateWorker(
|
||||
return updateWorker(workspaceDir, groupId, role, {
|
||||
active: false,
|
||||
issueId: null,
|
||||
startTime: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export async function checkWorkerHealth(opts: {
|
||||
fixed: false,
|
||||
};
|
||||
if (autoFix) {
|
||||
await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null });
|
||||
await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, startTime: null });
|
||||
fix.fixed = true;
|
||||
}
|
||||
fixes.push(fix);
|
||||
@@ -95,7 +95,7 @@ export async function checkWorkerHealth(opts: {
|
||||
await revertIssueLabel(fix);
|
||||
const sessions = { ...worker.sessions };
|
||||
if (worker.tier) sessions[worker.tier] = null;
|
||||
await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, sessions });
|
||||
await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, startTime: null, sessions });
|
||||
fix.fixed = true;
|
||||
}
|
||||
fixes.push(fix);
|
||||
@@ -135,7 +135,7 @@ export async function checkWorkerHealth(opts: {
|
||||
};
|
||||
if (autoFix) {
|
||||
await revertIssueLabel(fix);
|
||||
await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null });
|
||||
await updateWorker(workspaceDir, groupId, role, { active: false, issueId: null, startTime: null });
|
||||
fix.fixed = true;
|
||||
}
|
||||
fixes.push(fix);
|
||||
|
||||
Reference in New Issue
Block a user