Node.js based forum software built for the modern web
fix: don't crash process on error in cronjobs
Barış Soner Uşaklı89465ec6040b
diff --git a/src/activitypub/actors.js b/src/activitypub/actors.jsindex b9feb2b72b..169e55dd09 100644--- a/src/activitypub/actors.js+++ b/src/activitypub/actors.js@@ -279,8 +279,12 @@ Actors.prune = async () => {const count = counts[idx];if (count < 1) {- await user.deleteAccount(uid);- deletionCount += 1;+ try {+ await user.deleteAccount(uid);+ deletionCount += 1;+ } catch (err) {+ winston.error(err.stack);+ }} else {reassertionSet.add(uid);}diff --git a/src/activitypub/index.js b/src/activitypub/index.jsindex 055be9d895..91e05aa619 100644--- a/src/activitypub/index.js+++ b/src/activitypub/index.js@@ -44,8 +44,21 @@ ActivityPub.actors = require('./actors');ActivityPub.startJobs = () => {// winston.verbose('[activitypub/jobs] Registering jobs.');- new CronJob('0 0 * * *', ActivityPub.notes.prune, null, true, null, null, false); // change last argument to true for debugging- new CronJob('0 1 * * *', ActivityPub.actors.prune, null, true, null, null, false); // change last argument to true for debugging+ new CronJob('0 0 * * *', async () => {+ try {+ await ActivityPub.notes.prune();+ } catch (err) {+ winston.error(err.stack);+ }+ }, null, true, null, null, false); // change last argument to true for debugging++ new CronJob('0 1 * * *', async () => {+ try {+ await ActivityPub.actors.prune();+ } catch (err) {+ winston.error(err.stack);+ }+ },, null, true, null, null, false); // change last argument to true for debugging};ActivityPub.resolveId = async (uid, id) => {