From 30e098ae7ee341ec3808f14ec9a39916f672f1eb Mon Sep 17 00:00:00 2001 From: Stephen Hand Date: Tue, 13 Aug 2024 09:52:47 +0100 Subject: [PATCH] Comments --- .../taskrouterListeners/adjustCapacityListener.private.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/taskrouterListeners/adjustCapacityListener.private.ts b/functions/taskrouterListeners/adjustCapacityListener.private.ts index 9f5efb37..4f683324 100644 --- a/functions/taskrouterListeners/adjustCapacityListener.private.ts +++ b/functions/taskrouterListeners/adjustCapacityListener.private.ts @@ -37,6 +37,13 @@ type EnvVars = { */ export const shouldHandle = (event: EventFields) => eventTypes.includes(event.EventType); +/** + * After a reservation is accepted, we reset the capacity to 1 + * We only need to increase capacity temporarily to accept an additional task under certain circumstances like transfers and manual task pulls + * So since for 'regular' auto assigned tasks resetting to 1 is a noop, we can just always reset to 1 when any reservation is accepted / rejected + * @param context + * @param event + */ export const handleEvent = async (context: Context, event: EventFields) => { try { const { @@ -59,7 +66,6 @@ export const handleEvent = async (context: Context, event: EventFields) // eslint-disable-next-line global-require,import/no-dynamic-require,prefer-destructuring const adjustChatCapacity: AdjustChatCapacityType = require(path).adjustChatCapacity; - const body = { workerSid, adjustment: 'setTo1',