mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:10:45 +00:00
build: enable additional oxlint rules
This commit is contained in:
@@ -492,7 +492,6 @@ export async function handleFeishuMessage(params: {
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
@@ -329,7 +329,7 @@ export async function createMattermostDirectChannelWithRetry(
|
||||
// Calculate exponential backoff delay with full-jitter
|
||||
// Jitter is proportional to the exponential delay, not a fixed 1000ms
|
||||
// This ensures backoff behaves correctly for small delay configurations
|
||||
const exponentialDelay = initialDelayMs * Math.pow(2, attempt);
|
||||
const exponentialDelay = initialDelayMs * 2 ** attempt;
|
||||
const jitter = Math.random() * exponentialDelay;
|
||||
const delayMs = Math.min(exponentialDelay + jitter, maxDelayMs);
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ describe("Reconnect Backoff", () => {
|
||||
const JITTER = 0.3;
|
||||
|
||||
for (let attempt = 0; attempt < 10; attempt++) {
|
||||
const exponential = BASE * Math.pow(2, attempt);
|
||||
const exponential = BASE * 2 ** attempt;
|
||||
const capped = Math.min(exponential, MAX);
|
||||
const minDelay = capped * (1 - JITTER);
|
||||
const maxDelay = capped * (1 + JITTER);
|
||||
|
||||
@@ -84,9 +84,7 @@ export async function withRetry<T>(
|
||||
// Schedule the next retry with the configured backoff.
|
||||
if (attempt < policy.maxRetries) {
|
||||
const delay =
|
||||
policy.backoff === "exponential"
|
||||
? policy.baseDelayMs * Math.pow(2, attempt)
|
||||
: policy.baseDelayMs;
|
||||
policy.backoff === "exponential" ? policy.baseDelayMs * 2 ** attempt : policy.baseDelayMs;
|
||||
|
||||
logger?.debug?.(
|
||||
`[qqbot:retry] Attempt ${attempt + 1} failed, retrying in ${delay}ms: ${lastError.message.slice(0, 100)}`,
|
||||
|
||||
@@ -119,7 +119,7 @@ export async function sendMessage(
|
||||
}
|
||||
|
||||
if (attempt < maxRetries - 1) {
|
||||
await sleep(baseDelay * Math.pow(2, attempt));
|
||||
await sleep(baseDelay * 2 ** attempt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ export async function monitorTlonProvider(opts: MonitorTlonOpts = {}): Promise<v
|
||||
if (attempt >= maxAttempts) {
|
||||
throw error;
|
||||
}
|
||||
const delay = Math.min(30000, 1000 * Math.pow(2, attempt - 1));
|
||||
const delay = Math.min(30000, 1000 * 2 ** (attempt - 1));
|
||||
runtime.log?.(`[tlon] Retrying authentication in ${delay}ms...`);
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
const timer = setTimeout(resolve, delay);
|
||||
|
||||
@@ -376,7 +376,7 @@ export class UrbitSSEClient {
|
||||
|
||||
this.reconnectAttempts += 1;
|
||||
const delay = Math.min(
|
||||
this.reconnectDelay * Math.pow(2, this.reconnectAttempts - 1),
|
||||
this.reconnectDelay * 2 ** (this.reconnectAttempts - 1),
|
||||
this.maxReconnectDelay,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user