Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Troisi committed Dec 20, 2024
1 parent 04c2d2d commit 5b3d922
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions routes/webhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,17 @@ router.post('/kb/reindex', async (req, res) => {
// Assuming the content has been deleted. The scheduler should be stopped and deleted.
res.status(200).send({ success: true, message: "Content no longer exists. Deleting scheduler..." })

let aiReindexService = new AiReindexService();
let deleteResponse = await aiReindexService.delete(content_id).catch((err) => {
winston.error("(webhook) Error deleting scheduler ", err);
winston.error("(webhook) Error deleting scheduler " + err);
setTimeout( async () => {
let aiReindexService = new AiReindexService();
let deleteResponse = await aiReindexService.delete(content_id).catch((err) => {
winston.error("(webhook) Error deleting scheduler ", err);
winston.error("(webhook) Error deleting scheduler " + err);
return;
// res.status(500).send({ success: false, message: "Content no longer exists. Error deleting scheduler", error: err })
});
winston.info("(webhook) delete response: ", deleteResponse);
return;
// res.status(500).send({ success: false, message: "Content no longer exists. Error deleting scheduler", error: err })
});
winston.info("(webhook) delete response: ", deleteResponse);
return;
}, 10000);
}

let json = {
Expand Down

0 comments on commit 5b3d922

Please sign in to comment.