Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bull
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 175
    • Issues 175
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OptimalBits
  • bull
  • Issues
  • #1900
Closed
Open
Issue created Nov 03, 2020 by Administrator@rootContributor

The job returned by Queue.add() is not updated by progress()

Created by: oxabz

Summary

The progress value of the Job returned by Queue.add() isn't updated. It's a surprising behavior considering that the Job objects returned by the events are. Is it an intended behavior? If it is it should probably be added in the reference documentation

Reproduce / Test

When executing this program :

const Queue = require('bull')

let returnedJob = null
let activeJob = null

let queue = new Queue('test');
queue.process(async (_job, done) => {
    await new Promise((resolve, reject) => {
        let progress = 0
        let i = setInterval(async () => {
            progress += 1;
            await _job.progress(progress)
            if(progress == 100){
                clearInterval(i)
                resolve()
            }
        }, 100)
    })
    done()
})
queue.on('active', (job)=>{
    activeJob = job
})
queue.on('progress', async (_job) => {
    console.log('event_job : ' + await _job.progress())
    console.log('active_job : ' + await activeJob.progress())
    console.log('returned_job : ' + await returnedJob.progress())
})
queue.add({}).then((_job) => { returnedJob = _job})

We obtain the following traces :

...
event_job : 97
active_job : 97
returned_job : 0
event_job : 98
active_job : 98
returned_job : 0
event_job : 99
active_job : 99
returned_job : 0
event_job : 100
active_job : 100
returned_job : 0

Version

  • node :
    • v12.19.0
    • v14.13.1
  • bull : 3.18.1
Assignee
Assign to
Time tracking