openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
26 lines (25 loc) • 1.21 kB
JavaScript
import { r as createLazyRuntimeModule } from "./lazy-runtime-CgCh8H_K.js";
import { b as runWithGatewayIndependentRootWorkAdmission } from "./gateway-work-admission-R1IpuDim.js";
import { t as drainPendingDeliveriesCore } from "./delivery-queue-recovery-CeXGRhn8.js";
//#region src/plugin-sdk/delivery-queue-runtime.ts
const loadOutboundDeliverRuntime = createLazyRuntimeModule(() => import("./deliver-runtime-BeaXb33O.js"));
/**
* Drain queued outbound payloads after a channel reconnect or transport recovery.
* When no deliver function is provided, the heavy outbound delivery runtime is
* loaded lazily so importing this SDK subpath does not eagerly bind send internals.
*/
async function drainPendingDeliveries(opts) {
await runWithGatewayIndependentRootWorkAdmission(async () => {
const deliver = opts.deliver ?? (await loadOutboundDeliverRuntime()).deliverOutboundPayloadsInternal;
await drainPendingDeliveriesCore({
...opts,
deliver,
selectEntry: (entry, now) => entry.deliveryCompletion?.kind === "conversation" ? {
match: false,
bypassBackoff: false
} : opts.selectEntry(entry, now)
});
}, "delivery-queue:drain");
}
//#endregion
export { drainPendingDeliveries as t };