* Add event to batch and schedule flush
(event: any)
| 32 | * Add event to batch and schedule flush |
| 33 | */ |
| 34 | function addToBatch(event: any): void { |
| 35 | if (!telemetryEnabled) return |
| 36 | |
| 37 | eventBatch.push(event) |
| 38 | |
| 39 | if (eventBatch.length >= MAX_BATCH_SIZE) { |
| 40 | flushBatch() |
| 41 | } else if (!batchTimer) { |
| 42 | batchTimer = setTimeout(flushBatch, BATCH_INTERVAL_MS) |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * Flush batch of events to server |
no test coverage detected