mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-04 11:01:16 +01:00
18 lines
768 B
TypeScript
18 lines
768 B
TypeScript
import type { createDeliveryWorkCoordinator } from "./delivery-work-coordinator.js";
|
|
import { DELIVERY_QUEUES } from "./delivery-work-notifications.js";
|
|
import { registerDeadlineWork } from "./deadline-work.js";
|
|
import type { createToolGatewayService } from "./tool-gateway.js";
|
|
|
|
export function registerGatewayCredentialExpiryWork(
|
|
coordinator: ReturnType<typeof createDeliveryWorkCoordinator>,
|
|
gateway: Pick<ReturnType<typeof createToolGatewayService>, "cleanupExpiredSessions" | "nextCredentialExpiryAt">,
|
|
canRun: () => boolean,
|
|
) {
|
|
return registerDeadlineWork(coordinator, DELIVERY_QUEUES.gatewayCredentialExpiry, {
|
|
retryMs: 30_000,
|
|
canRun,
|
|
run: () => gateway.cleanupExpiredSessions(),
|
|
next: () => gateway.nextCredentialExpiryAt(),
|
|
});
|
|
}
|