mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-13 12:37:17 +08:00
Workaround for occasional crash in scrubber
This commit is contained in:
21
lib/db.js
21
lib/db.js
@@ -199,7 +199,7 @@ Store.prototype.scrubQuery = function (query) {
|
||||
// private mongo ids can be anywhere in a query object
|
||||
// walk the object recursively replacing id with _id
|
||||
// NOTE: if you are implementing your own Store,
|
||||
// you probably wont need to do this if you want sotre ids
|
||||
// you probably wont need to do this if you want store ids
|
||||
// as 'id'
|
||||
|
||||
if(query.id && typeof query.id === 'object') {
|
||||
@@ -207,13 +207,18 @@ Store.prototype.scrubQuery = function (query) {
|
||||
delete query.id;
|
||||
}
|
||||
|
||||
scrub(query, function (obj, key, parent, type) {
|
||||
// find any value using _id
|
||||
if(key === 'id' && parent.id) {
|
||||
parent._id = parent.id;
|
||||
delete parent.id;
|
||||
}
|
||||
});
|
||||
try {
|
||||
scrub(query, function (obj, key, parent, type) {
|
||||
// find any value using _id
|
||||
if(key === 'id' && parent.id) {
|
||||
parent._id = parent.id;
|
||||
delete parent.id;
|
||||
}
|
||||
});
|
||||
} catch(ex) {
|
||||
debug(ex);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ function Server(options) {
|
||||
server.router = router;
|
||||
|
||||
server.resources = resourcesInstances;
|
||||
router.route(req, res);
|
||||
router.route(req, res);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user