Skip to content

Commit 2132a9f

Browse files
author
Vikas Agarwal
committed
Handling erroring projects in bulk update, now it ignore the failing ones and log their ids.
1 parent 89d389f commit 2132a9f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/routes/admin/project-index-create.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,15 @@ module.exports = [
7070
return _.merge(single, _.pick(detail, 'handle', 'firstName', 'lastName', 'email'));
7171
});
7272
return project;
73+
})
74+
.catch((error) => {
75+
logger.error(`Error in getting project member details for (projectId: ${project.id})`, error);
76+
return null;
7377
});
78+
})
79+
.catch((error) => {
80+
logger.error(`Error in getting project active members (projectId: ${project.id})`, error);
81+
return null;
7482
});
7583
});
7684
Promise.all(projects).then((projectResponses) => {
@@ -88,6 +96,10 @@ module.exports = [
8896
logger.trace('body[0]', body[0]);
8997
logger.trace('body[length-1]', body[body.length - 1]);
9098
}
99+
100+
res.status(200).json(util.wrapResponse(req.id, {
101+
message: `Reindex request successfully submitted for ${body.length / 2} projects`
102+
}));
91103
// bulk index
92104
eClient.bulk({
93105
body,
@@ -98,8 +110,9 @@ module.exports = [
98110
.catch((error) => {
99111
logger.error(`Error in indexing project (projectId: ${projectIdStart}-${projectIdEnd})`, error);
100112
});
113+
}).catch((error) => {
114+
logger.error(`Error in getting project details for indexing (projectId: ${projectIdStart}-${projectIdEnd})`, error);
101115
});
102-
res.status(200).json(util.wrapResponse(req.id, { message: 'Reindex request successfully submitted' }));
103116
})
104117
.catch(err => next(err));
105118
},

0 commit comments

Comments
 (0)