mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
chore: We have a sleep at home. The sleep at home:
This commit is contained in:
@@ -15,6 +15,7 @@ vi.mock("../agents/pi-embedded.js", () => ({
|
||||
|
||||
import { resetInboundDedupe } from "../auto-reply/reply/inbound-dedupe.js";
|
||||
import { resetLogger, setLoggerOverride } from "../logging.js";
|
||||
import { sleep } from "../utils.js";
|
||||
import { monitorWebChannel } from "./auto-reply.js";
|
||||
import { resetBaileysMocks, resetLoadConfigMock, setLoadConfigMock } from "./test-helpers.js";
|
||||
|
||||
@@ -33,7 +34,7 @@ const rmDirWithRetries = async (dir: string): Promise<void> => {
|
||||
? String((err as { code?: unknown }).code)
|
||||
: null;
|
||||
if (code === "ENOTEMPTY" || code === "EBUSY" || code === "EPERM") {
|
||||
await new Promise((resolve) => setTimeout(resolve, 25));
|
||||
await sleep(25);
|
||||
continue;
|
||||
}
|
||||
throw err;
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { WebInboundMsg } from "./types.js";
|
||||
import { chunkMarkdownTextWithMode, type ChunkMode } from "../../auto-reply/chunk.js";
|
||||
import { logVerbose, shouldLogVerbose } from "../../globals.js";
|
||||
import { convertMarkdownTables } from "../../markdown/tables.js";
|
||||
import { sleep } from "../../utils.js";
|
||||
import { loadWebMedia } from "../media.js";
|
||||
import { newConnectionId } from "../reconnect.js";
|
||||
import { formatError } from "../session.js";
|
||||
@@ -36,8 +37,6 @@ export async function deliverWebReply(params: {
|
||||
? [replyResult.mediaUrl]
|
||||
: [];
|
||||
|
||||
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
const sendWithRetry = async (fn: () => Promise<unknown>, label: string, maxAttempts = 3) => {
|
||||
let lastErr: unknown;
|
||||
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
||||
|
||||
Reference in New Issue
Block a user