Skip to content

Commit

Permalink
Fixing not waiting for promises to resolve.
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisAlejandro committed Mar 22, 2024
1 parent c61f63d commit c300e2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app/services/backups.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module.exports = (Model, App) => {

const folders = await Model.folder.findAll({ where: { bucket: backupsBucket } });

return folders.map(async (folder) => {
const hasBackupFolders = await Promise.all(folders.map(async (folder) => {
const device = await Model.device.findOne({
where: { name: folder.name, userId: userData.id },
include: [{ model: Model.backup }],
Expand All @@ -169,7 +169,8 @@ module.exports = (Model, App) => {
}

return { ...folder, hasBackups, lastBackupAt };
});
}));
return hasBackupFolders;
};

const create = async ({ userId, path, deviceId, encryptVersion, interval, enabled }) => {
Expand Down

0 comments on commit c300e2e

Please sign in to comment.