(params: FinalizeQueueStateParams)
| 84 | } |
| 85 | |
| 86 | export const finalizeQueueState = (params: FinalizeQueueStateParams): void => { |
| 87 | const { |
| 88 | setStreamStatus, |
| 89 | setCanProcessQueue, |
| 90 | updateChainInProgress, |
| 91 | isProcessingQueueRef, |
| 92 | isQueuePausedRef, |
| 93 | resumeQueue, |
| 94 | } = params |
| 95 | |
| 96 | setStreamStatus('idle') |
| 97 | // Release lock here as part of normal completion flow. |
| 98 | // Also released in finally block and .catch() as safety nets (idempotent). |
| 99 | if (isProcessingQueueRef) { |
| 100 | isProcessingQueueRef.current = false |
| 101 | } |
| 102 | if (resumeQueue) { |
| 103 | resumeQueue() |
| 104 | } else { |
| 105 | setCanProcessQueue(!isQueuePausedRef?.current) |
| 106 | } |
| 107 | updateChainInProgress(false) |
| 108 | } |
| 109 | |
| 110 | const DEFAULT_RUN_OUTPUT_ERROR_MESSAGE = 'No output from agent run' |
| 111 |
no test coverage detected