Comparing version 5.8.2 to 5.8.3
@@ -119,5 +119,5 @@ | ||
if (this.username && this.password) { | ||
authString = `${ this.username }:${ this.password }@`; | ||
authString = `${this.username}:${this.password}@`; | ||
} | ||
const url = `amqp://${ authString }${ this.hostname }:${ this.port }`; | ||
const url = `amqp://${authString}${this.hostname}:${this.port}`; | ||
this.log.info({ url: url }, 'connecting'); | ||
@@ -176,6 +176,6 @@ return Promise.resolve(amqplib.connect(url, {})).catch(err => { | ||
if (typeof task === 'string') { | ||
return this._assertQueue(`${ this.name }.${ task }`); | ||
return this._assertQueue(`${this.name}.${task}`); | ||
} | ||
return this._assertQueue(`${ this.name }.${ task.name }`, task); | ||
return this._assertQueue(`${this.name}.${task.name}`, task); | ||
}); | ||
@@ -236,3 +236,3 @@ }).return(); | ||
return Promise.try(() => { | ||
const queueName = `${ this.name }.${ queue }`; | ||
const queueName = `${this.name}.${queue}`; | ||
this._validatePublish(queue, content, 'tasks'); | ||
@@ -323,3 +323,3 @@ const payload = RabbitMQ.buildJobPayload(content); | ||
subscribeToQueue(queue, handler, queueOptions) { | ||
const queueName = `${ this.name }.${ queue }`; | ||
const queueName = `${this.name}.${queue}`; | ||
const log = this.log.child({ | ||
@@ -335,3 +335,3 @@ method: 'subscribeToQueue', | ||
log.error('handler must be a function'); | ||
return Promise.reject(new Error(`handler for ${ queueName } must be a function`)); | ||
return Promise.reject(new Error(`handler for ${queueName} must be a function`)); | ||
} | ||
@@ -341,3 +341,3 @@ return Promise.try(() => { | ||
this.subscriptions = this.subscriptions.set(queueName, handler); | ||
this.subscribed = this.subscribed.add(`queue:::${ queueName }`); | ||
this.subscribed = this.subscribed.add(`queue:::${queueName}`); | ||
}); | ||
@@ -580,8 +580,8 @@ } | ||
} | ||
let subscribedKey = `${ opts.type }:::${ opts.exchange }`; | ||
let subscribedKey = `${opts.type}:::${opts.exchange}`; | ||
if (opts.type === 'topic' && opts.routingKey) { | ||
subscribedKey = `${ subscribedKey }:::${ opts.routingKey }`; | ||
subscribedKey = `${subscribedKey}:::${opts.routingKey}`; | ||
} | ||
if (this.subscribed.has(subscribedKey)) { | ||
log.warn(`already subscribed to ${ opts.type } exchange`); | ||
log.warn(`already subscribed to ${opts.type} exchange`); | ||
return Promise.resolve(); | ||
@@ -591,5 +591,5 @@ } | ||
log.trace('asserting queue for exchange'); | ||
let queueName = `${ this.name }.${ opts.exchange }`; | ||
let queueName = `${this.name}.${opts.exchange}`; | ||
if (opts.type === 'topic' && opts.routingKey) { | ||
queueName = `${ queueName }.${ opts.routingKey }`; | ||
queueName = `${queueName}.${opts.routingKey}`; | ||
} | ||
@@ -661,3 +661,3 @@ | ||
if (!job) { | ||
throw new Error(`${ type }: "${ name }" not defined in constructor`); | ||
throw new Error(`${type}: "${name}" not defined in constructor`); | ||
} | ||
@@ -664,0 +664,0 @@ |
{ | ||
"name": "ponos", | ||
"version": "5.8.2", | ||
"version": "5.8.3", | ||
"description": "An opinionated queue based worker server for node.", | ||
@@ -77,3 +77,3 @@ "main": "lib/index.js", | ||
"joi": "^9.0.4", | ||
"monitor-dog": "1.5.0", | ||
"monitor-dog": "1.5.2", | ||
"ratelimiter": "^2.1.3", | ||
@@ -80,0 +80,0 @@ "redis": "^2.6.2", |
95767
27
+ Addedmonitor-dog@1.5.2(transitive)
- Removedmonitor-dog@1.5.0(transitive)
Updatedmonitor-dog@1.5.2