add await

This commit is contained in:
Barış Soner Uşaklı
2023-05-22 12:02:34 -04:00
parent 7ab05f5dfd
commit 3066519028

View File

@@ -124,10 +124,9 @@ module.exports = function (Posts) {
}));
orphans = orphans.filter(Boolean);
// Note: no await. Deletion not guaranteed by method end.
orphans.forEach((relPath) => {
file.delete(_getFullPath(relPath));
});
await Promise.all(orphans.map(async (relPath) => {
await file.delete(_getFullPath(relPath));
}));
return orphans;
};