( executionId: string, writer: ExecutionEventWriter )
| 464 | } |
| 465 | |
| 466 | export async function flushExecutionStreamReplayBuffer( |
| 467 | executionId: string, |
| 468 | writer: ExecutionEventWriter |
| 469 | ): Promise<boolean> { |
| 470 | let writerClosed = false |
| 471 | for (let attempt = 1; attempt <= FINALIZE_FLUSH_ATTEMPTS; attempt++) { |
| 472 | try { |
| 473 | if (!writerClosed) { |
| 474 | await writer.close() |
| 475 | writerClosed = true |
| 476 | } |
| 477 | return true |
| 478 | } catch (error) { |
| 479 | logger.warn('Failed to flush execution stream replay buffer during finalization', { |
| 480 | executionId, |
| 481 | attempt, |
| 482 | error: toError(error).message, |
| 483 | }) |
| 484 | } |
| 485 | } |
| 486 | return false |
| 487 | } |
| 488 | |
| 489 | export async function resetExecutionStreamBuffer(executionId: string): Promise<boolean> { |
| 490 | const redis = getRedisClient() |
no test coverage detected