Comparing version 3.0.0 to 3.0.1
@@ -0,1 +1,6 @@ | ||
# 3.0.1 | ||
Minor bug fix when running test suite, purgeQueues would fail to work correctly. | ||
# 3.0.0 | ||
@@ -2,0 +7,0 @@ |
@@ -199,13 +199,2 @@ // Represents a Beanstalkd session that works similar to an IronMQ client. | ||
// Close this session | ||
end() { | ||
if (this._connectPromise) { | ||
this._connectPromise | ||
.then(client => client.end()) | ||
.catch(()=> null); | ||
this._connectPromise = null; | ||
} | ||
} | ||
del(message_id, options, callback) { | ||
@@ -223,4 +212,4 @@ return this.request('destroy', message_id) | ||
peek(options, callback) { | ||
const peekReady = this.request('peek_ready').then((result)=> result[0]).catch(()=> null); | ||
const peekDelayed = this.request('peek_delayed').then((result)=> result[0]).catch(()=> null); | ||
const peekReady = this.request('peek_ready').then(result => result[0]).catch(()=> null); | ||
const peekDelayed = this.request('peek_delayed').then(result => result[0]).catch(()=> null); | ||
return Promise.all([ peekReady, peekDelayed ]) | ||
@@ -244,3 +233,3 @@ .then(function(ids) { | ||
.then(function(job) { | ||
const id = job[0]; | ||
const id = job[0]; | ||
const body = job[1]; | ||
@@ -250,3 +239,3 @@ const reservation_id = id; | ||
const message = { id, body, reserved_count, reservation_id }; | ||
const message = { id, body, reserved_count, reservation_id }; | ||
callback(null, message); | ||
@@ -253,0 +242,0 @@ }) |
@@ -134,3 +134,3 @@ 'use strict'; | ||
this._handlers = new Set(); | ||
this.stop(); | ||
this._processing = false; | ||
@@ -231,5 +231,5 @@ // Used to limit concurrency for stream processing (see throttle method) | ||
stop() { | ||
this._processing = false; | ||
this._getSessionAsync = null; | ||
this._putSessionAsync = null; | ||
this._processing = false; | ||
this._getSessionPromise = null; | ||
this._putSessionPromise = null; | ||
} | ||
@@ -275,3 +275,3 @@ | ||
_reserveAndProcess(client) { | ||
return this._reserveJob(client) | ||
return this._reserveJob(client, 0) | ||
.then((job)=> { | ||
@@ -304,3 +304,3 @@ if (job) | ||
const backoff = ifProduction(RESERVE_BACKOFF); | ||
this._reserveJob(client) | ||
this._reserveJob(client, ms('1m')) | ||
.then((job)=> this._runAndDestroy(client, job)) | ||
@@ -314,13 +314,12 @@ .catch(()=> Bluebird.delay(backoff)) | ||
// _reserveAndProcess and _processContinuously use this | ||
_reserveJob(client) { | ||
_reserveJob(client, wait) { | ||
return new Promise(function(resolve, reject) { | ||
const timeout = msToSec(PROCESSING_TIMEOUT); | ||
client.reserve({ timeout }, function(error, job) { | ||
client.reserve({ timeout, wait }, function(error, job) { | ||
if (error && /not found/i.test(error.message)) | ||
resolve(); // IronMQ v3 API | ||
else if (error && /^TIMED_OUT/.test(error.message)) { | ||
client.end(); // beanstalkd API | ||
resolve(); | ||
} else if (error) | ||
else if (error && /^TIMED_OUT/.test(error.message)) | ||
resolve(); // beanstalkd API | ||
else if (error) | ||
reject(error); | ||
@@ -417,4 +416,2 @@ else | ||
purgeQueue() { | ||
this.stop(); | ||
// We're using the _putClient session (use), the _reserve session (watch) doesn't | ||
@@ -459,5 +456,5 @@ // return any jobs. | ||
get _putClientPromise() { | ||
if (!this._putSessionAsync) | ||
this._putSessionAsync = this._server.configPromise.then(client => this._putClientFromConfig(client)); | ||
return this._putSessionAsync; | ||
if (!this._putSessionPromise) | ||
this._putSessionPromise = this._server.configPromise.then(client => this._putClientFromConfig(client)); | ||
return this._putSessionPromise; | ||
} | ||
@@ -468,5 +465,5 @@ | ||
get _getClientPromise() { | ||
if (!this._getSessionAsync) | ||
this._getSessionAsync = this._server.configPromise.then(client => this._getClientFromConfig(client)); | ||
return this._getSessionAsync; | ||
if (!this._getSessionPromise) | ||
this._getSessionPromise = this._server.configPromise.then(client => this._getClientFromConfig(client)); | ||
return this._getSessionPromise; | ||
} | ||
@@ -473,0 +470,0 @@ |
{ | ||
"name": "ironium", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "test": "mocha", |
@@ -7,6 +7,3 @@ # [Ironium](https://www.npmjs.com/package/ironium) | ||
![](http://b.adge.me/npm/v/ironium.svg) | ||
![](http://b.adge.me/:license-MIT-green.svg) | ||
## The Why | ||
@@ -13,0 +10,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
102743
2004
593