mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: wrap majority of note assertion logic in try..catch to handle exceptions so that the lock is always released
This commit is contained in:
@@ -64,6 +64,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!options.skipChecks) {
|
||||
id = (await activitypub.checkHeader(id)) || id;
|
||||
}
|
||||
@@ -271,6 +272,11 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
||||
]);
|
||||
|
||||
return { tid, count };
|
||||
} catch (e) {
|
||||
winston.warn(`[activitypub/notes.assert] Could not assert ${id} (${e.message}), releasing lock.`);
|
||||
await unlock(id);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
Notes.assertPrivate = async (object) => {
|
||||
|
||||
Reference in New Issue
Block a user