Skip to content

Commit

Permalink
fix(grid-store): move into callback scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Lord authored and mbroadst committed Oct 18, 2017
1 parent 66a9a05 commit b53f65f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/gridfs/grid_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,11 @@ var writeFile = function(self, file, callback) {
if (offset >= stats.size) {
fs.close(file, function(err) {
if (err) return callback(err);
});
self.close(function(err) {
if (err) return callback(err, self);
return callback(null, self);

self.close(function(err) {
if (err) return callback(err, self);
return callback(null, self);
});
});
} else {
return process.nextTick(writeChunk);
Expand Down

0 comments on commit b53f65f

Please sign in to comment.