* Gets or creates a sequential wrapper for a session * This ensures that log appends for a session are processed one at a time
(sessionId: string)
| 40 | * This ensures that log appends for a session are processed one at a time |
| 41 | */ |
| 42 | function getOrCreateSequentialAppend(sessionId: string) { |
| 43 | let sequentialAppend = sequentialAppendBySession.get(sessionId) |
| 44 | if (!sequentialAppend) { |
| 45 | sequentialAppend = sequential( |
| 46 | async ( |
| 47 | entry: TranscriptMessage, |
| 48 | url: string, |
| 49 | headers: Record<string, string>, |
| 50 | ) => await appendSessionLogImpl(sessionId, entry, url, headers), |
| 51 | ) |
| 52 | sequentialAppendBySession.set(sessionId, sequentialAppend) |
| 53 | } |
| 54 | return sequentialAppend |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Internal implementation of appendSessionLog with retry logic |
no test coverage detected