style: format all source files with Prettier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* SealedSecret Custom Resource Definition
|
||||
*/
|
||||
|
||||
import { ApiProxy,K8s } from '@kinvolk/headlamp-plugin/lib';
|
||||
import { ApiProxy, K8s } from '@kinvolk/headlamp-plugin/lib';
|
||||
|
||||
const { apiFactoryWithNamespace } = ApiProxy;
|
||||
const { KubeObject } = K8s.cluster;
|
||||
|
||||
@@ -39,7 +39,10 @@ describe('retry logic', () => {
|
||||
.mockResolvedValueOnce({ ok: false, error: 'error2' })
|
||||
.mockResolvedValueOnce({ ok: true, value: 'success' });
|
||||
|
||||
const promise = retryWithBackoff(failTwiceThenSucceed, { maxAttempts: 3, initialDelayMs: 100 });
|
||||
const promise = retryWithBackoff(failTwiceThenSucceed, {
|
||||
maxAttempts: 3,
|
||||
initialDelayMs: 100,
|
||||
});
|
||||
await vi.runAllTimersAsync();
|
||||
const result = await promise;
|
||||
|
||||
@@ -72,7 +75,10 @@ describe('retry logic', () => {
|
||||
.mockResolvedValueOnce({ ok: false, error: 'error2' })
|
||||
.mockResolvedValueOnce({ ok: true, value: 'success' });
|
||||
|
||||
const promise = retryWithBackoff(failTwiceThenSucceed, { maxAttempts: 3, initialDelayMs: 1000 });
|
||||
const promise = retryWithBackoff(failTwiceThenSucceed, {
|
||||
maxAttempts: 3,
|
||||
initialDelayMs: 1000,
|
||||
});
|
||||
|
||||
// Fast-forward through retries
|
||||
await vi.runAllTimersAsync();
|
||||
|
||||
+6
-8
@@ -109,9 +109,7 @@ export async function retryWithBackoff<T, E>(
|
||||
const isLastAttempt = attempt === opts.maxAttempts - 1;
|
||||
if (isLastAttempt) {
|
||||
// No more retries, return final error
|
||||
return Err(
|
||||
`Operation failed after ${opts.maxAttempts} attempts:\n${errors.join('\n')}`
|
||||
);
|
||||
return Err(`Operation failed after ${opts.maxAttempts} attempts:\n${errors.join('\n')}`);
|
||||
}
|
||||
|
||||
// Wait before retrying
|
||||
@@ -124,9 +122,7 @@ export async function retryWithBackoff<T, E>(
|
||||
|
||||
const isLastAttempt = attempt === opts.maxAttempts - 1;
|
||||
if (isLastAttempt) {
|
||||
return Err(
|
||||
`Operation failed after ${opts.maxAttempts} attempts:\n${errors.join('\n')}`
|
||||
);
|
||||
return Err(`Operation failed after ${opts.maxAttempts} attempts:\n${errors.join('\n')}`);
|
||||
}
|
||||
|
||||
const delay = calculateDelay(attempt, opts);
|
||||
@@ -171,10 +167,12 @@ export function isRetryableHttpError(error: Error): boolean {
|
||||
}
|
||||
|
||||
// Check for specific retryable status codes
|
||||
return message.includes('429') || // Too Many Requests
|
||||
return (
|
||||
message.includes('429') || // Too Many Requests
|
||||
message.includes('408') || // Request Timeout
|
||||
message.includes('503') || // Service Unavailable
|
||||
message.includes('504'); // Gateway Timeout
|
||||
message.includes('504')
|
||||
); // Gateway Timeout
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user