MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / abortableSleep

Function abortableSleep

shift/shift.ts:547–572  ·  view source on GitHub ↗
(ms: number, signal?: AbortSignal)

Source from the content-addressed store, hash-verified

545 }, ms);
546
547 const onAbort = () => {
548 cleanup();
549 reject(new DOMException("Operation aborted", "AbortError"));
550 };
551
552 const cleanup = () => {
553 clearTimeout(timer);
554 signal?.removeEventListener("abort", onAbort);
555 };
556
557 signal?.addEventListener("abort", onAbort, { once: true });
558 });
559}
560
561// ====== Group forwarding helpers ======
562const groupBuffers = new Map<
563 string,
564 {
565 messages: any[];
566 timer: TimerHandle | null;
567 sourceId: number;
568 targetId: number;
569 options?: { silent?: boolean; replyTo?: number };
570 shouldForward?: boolean;
571 disposeTimer?: () => void | Promise<void>;
572 }
573>();
574
575function cleanupGroupBuffers(): void {

Callers 3

throttleMethod · 0.85
executeBackupMethod · 0.85
shiftForwardMessageFunction · 0.85

Calls 1

cleanupFunction · 0.70

Tested by

no test coverage detected