From cf37c4c6f8dc0a78d0ee19f4b67a2cacba1dfc5a 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/indexer-common/src/actions.ts b/packages/indexer-common/src/actions.ts index 9aec66814..1c16b706a 100644 --- a/packages/indexer-common/src/actions.ts +++ b/packages/indexer-common/src/actions.ts @@ -137,7 +137,11 @@ 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 + 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}'`, )