Fix: Added try/catch to CRON

This commit is contained in:
Dries Augustyns
2024-09-25 15:39:37 +02:00
parent 05463d0f78
commit c96a0074f8
2 changed files with 17 additions and 7 deletions
+16 -6
View File
@@ -4,12 +4,22 @@ import { API_URI } from "./constants";
export const task = cron.schedule("* * * * *", () => {
signale.info("Running scheduled tasks");
void fetch(`${API_URI}/tasks`, {
method: "POST",
});
try {
void fetch(`${API_URI}/tasks`, {
method: "POST",
});
} catch (e) {
signale.error("Failed to run scheduled tasks. Please check the error below");
console.error(e);
}
signale.info("Updating verified identities");
void fetch(`${API_URI}/identities/update`, {
method: "POST",
});
try {
void fetch(`${API_URI}/identities/update`, {
method: "POST",
});
} catch (e) {
signale.error("Failed to update verified identities. Please check the error below");
console.error(e);
}
});