mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 15:11:13 -05:00
Refactor: Remove circuit breaker system
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
*/
|
||||
|
||||
import { logger } from './logger';
|
||||
import { supabaseCircuitBreaker } from './circuitBreaker';
|
||||
import { supabase } from './supabaseClient';
|
||||
|
||||
export interface RetryOptions {
|
||||
@@ -216,10 +215,8 @@ export async function withRetry<T>(
|
||||
|
||||
for (let attempt = 0; attempt < config.maxAttempts; attempt++) {
|
||||
try {
|
||||
// Execute the function through circuit breaker
|
||||
const result = await supabaseCircuitBreaker.execute(async () => {
|
||||
return await fn();
|
||||
});
|
||||
// Execute the function directly
|
||||
const result = await fn();
|
||||
|
||||
// Log successful retry if not first attempt
|
||||
if (attempt > 0) {
|
||||
@@ -233,15 +230,6 @@ export async function withRetry<T>(
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
|
||||
// Check if circuit breaker blocked the request
|
||||
if (error instanceof Error && error.message.includes('Circuit breaker is OPEN')) {
|
||||
logger.error('Circuit breaker prevented retry', {
|
||||
attempt: attempt + 1,
|
||||
circuitState: supabaseCircuitBreaker.getState()
|
||||
});
|
||||
throw error; // Don't retry if circuit is open
|
||||
}
|
||||
|
||||
// Check if we should retry
|
||||
const isLastAttempt = attempt === config.maxAttempts - 1;
|
||||
const shouldRetry = config.shouldRetry(error);
|
||||
|
||||
Reference in New Issue
Block a user