stitchng / adonis-queue

An addon/plugin package to provide driver-based job queueing services in AdonisJS 4.0+
MIT License
34 stars 9 forks source link

[v0.1.6] HttpException causes the destroyAll method of queue to throw error #3

Closed stitchng closed 5 years ago

stitchng commented 5 years ago

Package version

v0.1.5

Node.js and npm version

v10 - NodeJS v6 - NPM

Actual Code (that causes the issue)

Line 165 , Col 28 (src/Queue/index.js)

async destroyAll () { // See: https://stackoverflow.com/questions/44410119/in-javascript-does-using-await-inside-a-loop-block-the-loop/44410481

for (let queue of this._queuesPool) { // TypeError: this.queuesPool is not iterable
  await this.close(queue)
  await this.destroy(queue)
}

}

stitchng commented 5 years ago

fixing this entails changing the above code to:

From line 165, Col 28 (src/Queue/index.js)


async destroyAll () {
    // See: https://stackoverflow.com/questions/44410119/in-javascript-does-using-await-inside-a-loop-block-the-loop/44410481

     for (let queueName in this._queuesPool) {
         if(this._queuesPool.hasOwnProperty(queueName)){
            let queue = this._queuesPool[queueName];
            await this.close(queue)
            await this.destroy(queue)
         }
     }
  }
stitchng commented 5 years ago

This was fixed in a release (v0.1.6) today on npm