refactor(telemetry): enhance flushToClearcut method with retry logic and early return for empty events (#1601)

Co-authored-by: Scott Densmore <scottdensmore@mac.com>
This commit is contained in:
Hyeladi Bassi
2025-07-27 19:18:27 +01:00
committed by GitHub
parent c45c14ee0e
commit a9f04eba2c
3 changed files with 76 additions and 61 deletions

View File

@@ -6,14 +6,9 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { retryWithBackoff } from './retry.js';
import { retryWithBackoff, HttpError } from './retry.js';
import { setSimulate429 } from './testUtils.js';
// Define an interface for the error with a status property
interface HttpError extends Error {
status?: number;
}
// Helper to create a mock function that fails a certain number of times
const createFailingFunction = (
failures: number,