mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: don't crash process on error in cronjobs
catch error to continue in actor.prune
This commit is contained in:
@@ -279,8 +279,12 @@ Actors.prune = async () => {
|
|||||||
|
|
||||||
const count = counts[idx];
|
const count = counts[idx];
|
||||||
if (count < 1) {
|
if (count < 1) {
|
||||||
await user.deleteAccount(uid);
|
try {
|
||||||
deletionCount += 1;
|
await user.deleteAccount(uid);
|
||||||
|
deletionCount += 1;
|
||||||
|
} catch (err) {
|
||||||
|
winston.error(err.stack);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
reassertionSet.add(uid);
|
reassertionSet.add(uid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,21 @@ ActivityPub.actors = require('./actors');
|
|||||||
|
|
||||||
ActivityPub.startJobs = () => {
|
ActivityPub.startJobs = () => {
|
||||||
// winston.verbose('[activitypub/jobs] Registering jobs.');
|
// 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 0 * * *', async () => {
|
||||||
new CronJob('0 1 * * *', ActivityPub.actors.prune, null, true, null, null, false); // change last argument to true for debugging
|
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) => {
|
ActivityPub.resolveId = async (uid, id) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user