Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the queue is not running on the redis #12

Open
farshadfahimi opened this issue Nov 19, 2020 · 4 comments
Open

the queue is not running on the redis #12

farshadfahimi opened this issue Nov 19, 2020 · 4 comments

Comments

@farshadfahimi
Copy link

I have a simple job like below

'use strict'

const Job = use('Job')

class Test extends Job {
  
    constructor(){
      super(arguments)
      
      this.timeOut = 2000; // seconds: time out for queue
      this.retryCount = 0; // number of times to retry
      this.retryUntil = 200; // seconds: retry
      this.delayUntil = 0; // seconds: delay
    }

    get queue () {
        return 'high'
    }

	async handle(link, done) {
		// ...
		console.log(`Job [${this.constructor.name}] - handler called: status=running; id=${this.id} `)
    }

    progress(progress) {
        // ...
        console.log(`Job [${this.constructor.name}] - progress:${progress}%: status=running; id=${this.id} `)
    }
  
    failed(error) {
        // ...
		console.log(`Job [${this.constructor.name}] - status:failed; id=${this.id} `, error.message)
	}
	
	retrying(error){
        // ...
		console.log(`Job [${this.constructor.name}] - status:retrying; id=${this.id} `, error.message)
	}

    succeeded(result){
        // ...
        console.log(`Job [${this.constructor.name}] - status:succeeded; id=${this.id} `, result)
    }
}

module.exports = Test

and simple in my controller just write the code for test the queue
queue.dispatch(new Test())
when this action is call in the console I got the below log

@@adonisjs/Queue: [Redis] Queue [high] now ready

but the handler method is not running and when I'm checking the redis the keys is empty.

the configoration of the queue is default config without any changes.

How should I run the queue ?

@isocroft
Copy link
Contributor

isocroft commented Jan 2, 2021

Hello @farshadfahimi . What version of adonis-queue are you using and did you follow all the instructions in the instructions.md file ?

@alfianazizi
Copy link

i'm experiencing the same issue with version 0.1.10, followed the instructions in the instructions.md.

at first, the queue is working and handling the job just fine, buat after some time it only outputs

@@adonisjs/Queue: [Redis] Queue [high] now ready

I'm running the queue with adonis events as example. did i miss something important?

@isocroft
Copy link
Contributor

@alfianazizi can you try to zero out the timeOut. Also, return true from the handle() method

Like so:

'use strict'

const Job = use('Job')

class Test extends Job {
  
    constructor(){
      super(arguments)
      
      this.timeOut = 0; // seconds: time out for queue
      this.retryCount = 0; // number of times to retry
      this.retryUntil = 200; // seconds: retry
      this.delayUntil = 0; // seconds: delay
    }

    get queue () {
        return 'high'
    }

	async handle(link, done) {
		// ...
		console.log(`Job [${this.constructor.name}] - handler called: status=running; id=${this.id} `)
		return true;
    }

@azproweb
Copy link

azproweb commented Mar 5, 2021

Same issue.

From package.json:

"dependencies": {
    "@adonisjs/ace": "^5.0.8",
    "@adonisjs/auth": "^3.0.7",
    "@adonisjs/bodyparser": "^2.0.5",
    "@adonisjs/cors": "^1.0.7",
    "@adonisjs/fold": "^4.0.9",
    "@adonisjs/framework": "^5.0.9",
    "@adonisjs/ignitor": "^2.0.8",
    "@adonisjs/lucid": "^6.1.3",
    "@adonisjs/mail": "^3.0.10",
    "@adonisjs/session": "^1.0.27",
    "@adonisjs/shield": "^1.0.8",
    "@adonisjs/validator": "^5.0.6",
    "adonisjs-queue": "^0.1.10"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants