Skip to content

Commit 5b73eef

Browse files
committed
fix: modify require setup
1 parent e284f7c commit 5b73eef

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ let QueueWrapper = function (options) {
2424
this.rsmq.on('disconnect', () => {
2525
this.connected = false
2626
})
27-
28-
return this
2927
}
3028

3129
// instantiate message queue
@@ -45,6 +43,8 @@ QueueWrapper.prototype.send = function (message, done) {
4543
delay: this.getDelay(message)
4644
}
4745

46+
console.log(options)
47+
4848
this.rsmq.sendMessage(options, done)
4949
}
5050

@@ -57,6 +57,8 @@ QueueWrapper.prototype.send = function (message, done) {
5757

5858
// do request, fail or wait
5959
QueueWrapper.prototype.request = function (req, err) {
60+
let rsmq = this.rsmq
61+
6062
if (this.connected === true) {
6163
return req()
6264
}
@@ -76,8 +78,8 @@ QueueWrapper.prototype.request = function (req, err) {
7678
}
7779

7880
function removeListeners () {
79-
this.rsmq.removeListener('connect', connect)
80-
this.rsmq.removeListener('disconnect', disconnect)
81+
rsmq.removeListener('connect', connect)
82+
rsmq.removeListener('disconnect', disconnect)
8183
}
8284

8385
this.rsmq.on('connect', connect)
@@ -119,7 +121,7 @@ QueueWrapper.prototype.untilStart = function () {
119121
}
120122
}
121123

122-
// parse time string from config file
124+
// parse time string from configured options
123125
QueueWrapper.prototype.parseTime = function (string) {
124126
const time = new Date()
125127
const timeParts = string.split(':')

test/queue.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,13 @@ let queueWrapper
3636
util.inherits(FakeRsmq, EventEmitter)
3737

3838
describe('QueueWrapper', function (done) {
39-
beforeEach(function (done) {
39+
beforeEach(function(done) {
4040
fakeRsmq = new FakeRsmq()
4141
sinon.stub(QueueWrapper.prototype, 'initialiseQueue').returns(fakeRsmq)
42-
4342
done()
4443
})
4544

46-
afterEach(function (done) {
45+
afterEach(function(done) {
4746
QueueWrapper.prototype.initialiseQueue.restore()
4847
done()
4948
})

0 commit comments

Comments
 (0)