stitchng / adonis-queue

An addon/plugin package to provide driver-based job queueing services in AdonisJS 4.0+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

stitchng opened this issue · comments

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)
    }
  }

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)
         }
     }
  }

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