gridfs-locks
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -0,1 +1,6 @@ | ||
### 1.2.1 | ||
- Fixed errors stemming from improper checking of the mongo error code in an emitted error object. | ||
- Ensure that lockExpiration >= pollingInterval, or expirations may become instantaneous | ||
### 1.2.0 | ||
@@ -2,0 +7,0 @@ |
21
index.js
@@ -126,2 +126,8 @@ /*********************************************************************** | ||
self.lockExpiration = 1000*(options.lockExpiration || self.lockCollection.lockExpiration); | ||
// This ensures that locks don't emit expirations immediately | ||
if (self.lockExpiration && self.lockExpiration < self.pollingInterval * 1.1) { | ||
self.lockExpiration = self.pollingInterval * 1.1 | ||
} | ||
self.lockExpireTime = new Date(self.timeCreated.getTime() + (self.lockExpiration || never)); | ||
@@ -135,2 +141,3 @@ self.timeOut = 1000*(options.timeOut || self.lockCollection.timeOut); | ||
self.expired = false; | ||
return self; | ||
@@ -462,7 +469,4 @@ }; | ||
function (err, doc) { | ||
// if (err) { console.log("ERROR:", err); } | ||
// | ||
// XXX: Handle unique index exception when simultaneous upserts collide... | ||
// | ||
if (err && ((err.name !== 'MongoError') || (err.lastErrorObject.code !== 11000))) { return emitError(self, err); } | ||
// if (err) { console.log("Error", err)} | ||
if (err && ((err.name !== 'MongoError') || (err.code !== 11000))) { return emitError(self, err); } | ||
if (!doc) { | ||
@@ -521,7 +525,4 @@ if (new Date().getTime() - self.timeCreated >= self.timeOut) { | ||
function (err, doc) { | ||
// if (err) { console.log("ERROR:", err); } | ||
// | ||
// XXX: Handle unique index exception when simultaneous upserts collide... | ||
// | ||
if (err && ((err.name !== 'MongoError') || (err.lastErrorObject.code !== 11000))) { return emitError(self, err); } | ||
// if (err) { console.log("Error", err)} | ||
if (err && ((err.name !== 'MongoError') || (err.code !== 11000))) { return emitError(self, err); } | ||
if (doc) { | ||
@@ -528,0 +529,0 @@ self.heldLock = doc; |
{ | ||
"name": "gridfs-locks", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Distributed read/write locking based on MongoDB, designed to make GridFS safe for concurrent access", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"mongodb": ">=1.4.2", | ||
"mongodb": ">=1.4.3", | ||
"coffee-script": "*", | ||
@@ -11,0 +11,0 @@ "mocha": "*" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85953
720