From 06100826e9c7ce3ca584e828a40218687420be48 Mon Sep 17 00:00:00 2001 From: Daniel Werner Date: Wed, 23 Oct 2024 09:00:51 -0700 Subject: [PATCH] agent: allow expired allocations to be reallocated with force --- packages/indexer-common/src/actions.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/indexer-common/src/actions.ts b/packages/indexer-common/src/actions.ts index 9aec66814..2567a7be1 100644 --- a/packages/indexer-common/src/actions.ts +++ b/packages/indexer-common/src/actions.ts @@ -137,7 +137,14 @@ export const validateActionInputs = async ( // allocationID must belong to active allocation // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const allocation = await networkMonitor.allocation(action.allocationID!) - if (allocation.status !== AllocationStatus.ACTIVE) { + + const forcedReallocate = + action.type === ActionType.REALLOCATE && action.force === true + // TODO && isZeroPOI(action.poi) + + if (forcedReallocate) { + logger.info(`forcing reallocate of id = '${action.allocationID}'`) + } else if (allocation.status !== AllocationStatus.ACTIVE) { throw new Error( `An active allocation does not exist with id = '${action.allocationID}'`, )