style: format code biome
Local Build and Deploy / deploy (push) Failing after 46s

This commit is contained in:
openhands committed 2026-07-13 21:57:41 +02:00
1 parent 8efd032cc6
commit df38dccbf1
735 files changed
+128321 -120870

No files matched your search

+29 -27
View File
@@ -3,37 +3,39 @@ import Redis from "ioredis";
const globalForRedis = globalThis as unknown as { redis?: Redis | null };
function createRedis(): Redis | null {
const url = process.env.REDIS_URL;
if (!url) return null;
try {
const client = new Redis(url, {
maxRetriesPerRequest: 3,
retryStrategy(times) {
if (times > 3) return null;
return Math.min(times * 200, 2000);
},
lazyConnect: true,
});
client.on("error", () => {});
return client;
} catch {
return null;
}
const url = process.env.REDIS_URL;
if (!url) return null;
try {
const client = new Redis(url, {
maxRetriesPerRequest: 3,
retryStrategy(times) {
if (times > 3) return null;
return Math.min(times * 200, 2000);
},
lazyConnect: true,
});
client.on("error", () => {});
return client;
} catch {
return null;
}
}
export const redis: Redis | null =
globalForRedis.redis !== undefined ? globalForRedis.redis : (globalForRedis.redis = createRedis());
globalForRedis.redis !== undefined
? globalForRedis.redis
: (globalForRedis.redis = createRedis());
export async function withRedis<T>(
fallback: () => Promise<T>,
redisFn: (client: Redis) => Promise<T>,
fallback: () => Promise<T>,
redisFn: (client: Redis) => Promise<T>,
): Promise<T> {
if (redis) {
try {
return await redisFn(redis);
} catch {
return fallback();
}
}
return fallback();
if (redis) {
try {
return await redisFn(redis);
} catch {
return fallback();
}
}
return fallback();
}