Comparing version 0.1.0-alpha.60 to 0.1.0-alpha.61
@@ -491,3 +491,2 @@ 'use strict'; | ||
if (err.name === 'NotFoundError') { | ||
this.locks.release(lockKey); | ||
// this situation might happen if we recovered a deferred delivery that was already processed | ||
@@ -498,2 +497,3 @@ // or there was a race condition where we started an iterator just before a key was deleted | ||
if (err && err.name === 'NotFoundError') { | ||
this.locks.release(lockKey); | ||
// zone key was not found, so this must be an iterator race, just ignore it | ||
@@ -522,2 +522,5 @@ return setImmediate(tryNext); | ||
delivery._lock = lockKey; | ||
log.info('Queue', '%s.%s SHIFTED (key="%s" iterator="%s")', delivery.id, delivery.seq, lockKey, iteratorName); | ||
callback(null, delivery); | ||
@@ -717,2 +720,5 @@ }); | ||
}, err => { | ||
// whatever happened, no need to hold the lock anymore | ||
this.locks.release(delivery._lock); | ||
if (err) { | ||
@@ -722,5 +728,2 @@ return callback(err); | ||
// safe to remove lock | ||
this.locks.release(delivery._lock); | ||
// Try to find a delivery reference for the message body. If references | ||
@@ -727,0 +730,0 @@ // are not found then this message body is no longer needed and can be deleted |
@@ -19,3 +19,3 @@ 'use strict'; | ||
if (lock.ttl < Date.now()) { | ||
this.releaseLock(key); | ||
this.release(key); | ||
} else { | ||
@@ -22,0 +22,0 @@ return true; |
{ | ||
"name": "zone-mta", | ||
"private": false, | ||
"version": "0.1.0-alpha.60", | ||
"version": "0.1.0-alpha.61", | ||
"description": "Tiny outbound MTA", | ||
@@ -6,0 +6,0 @@ "main": "app.js", |
@@ -51,3 +51,3 @@ 'use strict'; | ||
if (!rspamdStream.write(chunk)) { | ||
return rspamdStream.on('drain', readNext); | ||
return rspamdStream.once('drain', readNext); | ||
} | ||
@@ -54,0 +54,0 @@ readNext(); |
313566
6182