Rocketseat / adonis-bull

The easiest way to start using an asynchronous job queue with AdonisJS. Ready for Adonis v5 ⚡️
MIT License
310 stars 57 forks source link

Method inside the Job class is not callable #71

Closed LeCoupa closed 3 years ago

LeCoupa commented 3 years ago

The task below will trigger the following error when called.

TypeError: this.myMethod is not a function

export default class MyTask implements JobContract {
  public key = 'theTaskKey'

  public async handle(job) {
    this.myMethod()
  }

  public async myMethod() {}
}

Is there a way to call a method from the same class inside handle()?

HigoRibeiro commented 3 years ago

Hi @LeCoupa ! Unfortunately, as it is being done today it is not possible. But I will made a PR that fixes this.

LeCoupa commented 3 years ago

Thank you 😊

jpedroschmitz commented 3 years ago

Hey, I've just published 1.0.0-1 that should fix the issue.

Let me know if you have any problem @LeCoupa 💜

LeCoupa commented 3 years ago

Thank you 🙏