diff options
Diffstat (limited to 'packages/shared/queues.ts')
| -rw-r--r-- | packages/shared/queues.ts | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/packages/shared/queues.ts b/packages/shared/queues.ts index a2fdc6b4..6cc5dd83 100644 --- a/packages/shared/queues.ts +++ b/packages/shared/queues.ts @@ -1,5 +1,5 @@ import path from "node:path"; -import { buildDBClient, migrateDB, SqliteQueue } from "liteque"; +import { buildDBClient, EnqueueOptions, migrateDB, SqliteQueue } from "liteque"; import { z } from "zod"; import serverConfig from "./config"; @@ -86,25 +86,17 @@ export const TidyAssetsQueue = new SqliteQueue<ZTidyAssetsRequest>( }, ); -export async function triggerSearchReindex(bookmarkId: string) { - await SearchIndexingQueue.enqueue({ - bookmarkId, - type: "index", - }); -} - -export async function triggerSearchDeletion(bookmarkId: string) { - await SearchIndexingQueue.enqueue({ - bookmarkId: bookmarkId, - type: "delete", - }); -} - -export async function triggerReprocessingFixMode(bookmarkId: string) { - await AssetPreprocessingQueue.enqueue({ - bookmarkId, - fixMode: true, - }); +export async function triggerSearchReindex( + bookmarkId: string, + opts?: EnqueueOptions, +) { + await SearchIndexingQueue.enqueue( + { + bookmarkId, + type: "index", + }, + opts, + ); } export const zvideoRequestSchema = z.object({ @@ -124,13 +116,6 @@ export const VideoWorkerQueue = new SqliteQueue<ZVideoRequest>( }, ); -export async function triggerVideoWorker(bookmarkId: string, url: string) { - await VideoWorkerQueue.enqueue({ - bookmarkId, - url, - }); -} - // Feed Worker export const zFeedRequestSchema = z.object({ feedId: z.string(), @@ -191,12 +176,16 @@ export async function triggerWebhook( bookmarkId: string, operation: ZWebhookRequest["operation"], userId?: string, + opts?: EnqueueOptions, ) { - await WebhookQueue.enqueue({ - bookmarkId, - userId, - operation, - }); + await WebhookQueue.enqueue( + { + bookmarkId, + userId, + operation, + }, + opts, + ); } // RuleEngine worker @@ -219,9 +208,13 @@ export const RuleEngineQueue = new SqliteQueue<ZRuleEngineRequest>( export async function triggerRuleEngineOnEvent( bookmarkId: string, events: z.infer<typeof zRuleEngineEventSchema>[], + opts?: EnqueueOptions, ) { - await RuleEngineQueue.enqueue({ - events, - bookmarkId, - }); + await RuleEngineQueue.enqueue( + { + events, + bookmarkId, + }, + opts, + ); } |
