Skip to content

Commit

Permalink
Merge pull request #97 from useplunk/90-plunk-crashes-after-a-few-day…
Browse files Browse the repository at this point in the history
…s-of-running-on-railway

Fix: Added try/catch to CRON
  • Loading branch information
driaug authored Sep 25, 2024
2 parents 05463d0 + c96a007 commit b8da45b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plunk",
"version": "1.0.6",
"version": "1.0.7",
"private": true,
"license": "agpl-3.0",
"workspaces": {
Expand Down
22 changes: 16 additions & 6 deletions packages/api/src/app/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});

0 comments on commit b8da45b

Please sign in to comment.