diff --git a/shared/packages/expectationManager/src/expectationTracker/lib/trackedExpectationAPI.ts b/shared/packages/expectationManager/src/expectationTracker/lib/trackedExpectationAPI.ts index 66eaf92c..5995b4ff 100644 --- a/shared/packages/expectationManager/src/expectationTracker/lib/trackedExpectationAPI.ts +++ b/shared/packages/expectationManager/src/expectationTracker/lib/trackedExpectationAPI.ts @@ -187,7 +187,15 @@ export class TrackedExpectationAPI { noAssignedWorkerReason = trackedExp.session.noAssignedWorkerReason } - if (!trackedExp.noWorkerAssignedTime) trackedExp.noWorkerAssignedTime = Date.now() + if (!trackedExp.noWorkerAssignedTime) { + const now = Date.now() + this.logger.error( + `Setting trackedExp.noWorkerAssignedTime of "${expLabel(trackedExp)}" to ${now} (reason: ${ + noAssignedWorkerReason.tech + })` + ) + trackedExp.noWorkerAssignedTime = now + } // Special case: When WAITING and no worker was assigned, return to NEW so that another worker might be assigned: if (trackedExp.state === ExpectedPackageStatusAPI.WorkStatusState.WAITING) { diff --git a/shared/packages/expectationManager/src/internalManager/lib/trackedWorkerAgents.ts b/shared/packages/expectationManager/src/internalManager/lib/trackedWorkerAgents.ts index 88ee2513..6ab38f0e 100644 --- a/shared/packages/expectationManager/src/internalManager/lib/trackedWorkerAgents.ts +++ b/shared/packages/expectationManager/src/internalManager/lib/trackedWorkerAgents.ts @@ -174,7 +174,11 @@ export class TrackedWorkerAgents { public async assignWorkerToSession(trackedExp: TrackedExpectation): Promise { const session: ExpectationStateHandlerSession | null = trackedExp.session if (!session) throw new Error('ExpectationManager: Internal error: Session not set') - if (session.assignedWorker) return // A worker has already been assigned + if (session.assignedWorker) { + // A worker has already been assigned + trackedExp.noWorkerAssignedTime = null + return + } if (!trackedExp.availableWorkers.size) { session.noAssignedWorkerReason = { user: `No workers available`, tech: `No workers available` }