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
  • #1833
Closed
Open
Issue created Aug 26, 2020 by Administrator@rootContributor

BUG: Inconsistent delay property

Created by: tsebas

Description

When a job is created with queue.add with the delay param in opts, the resulting job has the delay property with the assigned value. However, in the queue processor, the job that comes in has the corret delay value in the opts object, whilst the delay property has 0.

Minimal, Working Test code to reproduce the issue.

const bull = require('bull');

const q = new bull('queue', {
	redis: {host: 'localhost', port: 6380, password: null},
});

q.process(job => {
	console.log('process', job.delay, job.opts.delay);
});

q.add({}, {delay: 1}).then(job => console.log('add', job.delay, job.opts.delay));

Bull version

"bull": "^3.14.0"

Additional information

The above code generates the following output. I added a console.log on Job.fromJSON function in bull/lib/job.js:576

add 1 1
json { name: '__default__',
  data: '{}',
  opts: '{"delay":1,"attempts":1,"timestamp":1598439486198}',
  timestamp: '1598439486198',
  delay: '0',
  priority: '0',
  processedOn: '1598439486213' }
process 0 1

I didn't fully debug the code to understand where the most appropriate fix would go, but I suspect the only actually problematic line is bull/lib/job.js:588 job.delay = parseInt(json.delay);. Before this line, the job.delay is correctly built form the constructor.

Assignee
Assign to
Time tracking