aboutsummaryrefslogtreecommitdiffstats
path: root/apps/workers/index.ts
diff options
context:
space:
mode:
author玄猫 <hanguofeng@gmail.com>2025-01-19 20:34:42 +0800
committerGitHub <noreply@github.com>2025-01-19 12:34:42 +0000
commitb9cce5d12baa40deb21ab4f36be19e3a41e18ad4 (patch)
treef4ec46c026c35ec2c70393b92f52b87e468746ef /apps/workers/index.ts
parentb323573047dee4c358f513fbb9b50174e9e98a99 (diff)
downloadkarakeep-b9cce5d12baa40deb21ab4f36be19e3a41e18ad4.tar.zst
feat(webhook): Implement webhook functionality for bookmark events (#852)
* feat(webhook): Implement webhook functionality for bookmark events - Added WebhookWorker to handle webhook requests. - Integrated webhook triggering in crawlerWorker after video processing. - Updated main worker initialization to include WebhookWorker. - Enhanced configuration to support webhook URLs, token, and timeout. - Documented webhook configuration options in the documentation. - Introduced zWebhookRequestSchema for validating webhook requests. * feat(webhook): Update webhook handling and configuration - Changed webhook operation type from "create" to "crawled" in crawlerWorker and documentation. - Enhanced webhook retry logic in WebhookWorker to support multiple attempts. - Updated Docker configuration to include new webhook environment variables. - Improved validation for webhook configuration in shared config. - Adjusted zWebhookRequestSchema to reflect the new operation type. - Updated documentation to clarify webhook configuration options and usage. * minor modifications --------- Co-authored-by: Mohamed Bassem <me@mbassem.com>
Diffstat (limited to 'apps/workers/index.ts')
-rw-r--r--apps/workers/index.ts34
1 files changed, 23 insertions, 11 deletions
diff --git a/apps/workers/index.ts b/apps/workers/index.ts
index c2d3f28a..3997b423 100644
--- a/apps/workers/index.ts
+++ b/apps/workers/index.ts
@@ -13,21 +13,31 @@ import { shutdownPromise } from "./exit";
import { OpenAiWorker } from "./openaiWorker";
import { SearchIndexingWorker } from "./searchWorker";
import { VideoWorker } from "./videoWorker";
+import { WebhookWorker } from "./webhookWorker";
async function main() {
logger.info(`Workers version: ${serverConfig.serverVersion ?? "not set"}`);
runQueueDBMigrations();
- const [crawler, openai, search, tidyAssets, video, feed, assetPreprocessing] =
- [
- await CrawlerWorker.build(),
- OpenAiWorker.build(),
- SearchIndexingWorker.build(),
- TidyAssetsWorker.build(),
- VideoWorker.build(),
- FeedWorker.build(),
- AssetPreprocessingWorker.build(),
- ];
+ const [
+ crawler,
+ openai,
+ search,
+ tidyAssets,
+ video,
+ feed,
+ assetPreprocessing,
+ webhook,
+ ] = [
+ await CrawlerWorker.build(),
+ OpenAiWorker.build(),
+ SearchIndexingWorker.build(),
+ TidyAssetsWorker.build(),
+ VideoWorker.build(),
+ FeedWorker.build(),
+ AssetPreprocessingWorker.build(),
+ WebhookWorker.build(),
+ ];
FeedRefreshingWorker.start();
await Promise.any([
@@ -39,11 +49,12 @@ async function main() {
video.run(),
feed.run(),
assetPreprocessing.run(),
+ webhook.run(),
]),
shutdownPromise,
]);
logger.info(
- "Shutting down crawler, openai, tidyAssets, video, feed, assetPreprocessing and search workers ...",
+ "Shutting down crawler, openai, tidyAssets, video, feed, assetPreprocessing, webhook and search workers ...",
);
FeedRefreshingWorker.stop();
@@ -54,6 +65,7 @@ async function main() {
video.stop();
feed.stop();
assetPreprocessing.stop();
+ webhook.stop();
}
main();