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
  • #1279
Closed
Open
Issue created Apr 12, 2019 by Administrator@rootContributor

Cannot do job.update when job runs in separate process

Created by: Gappa88

Description

I have changed the queue processor from a normal process to a separate process and now I cannot update a job anymore. It throws the following error: (node:7068) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: job.update is not a function

Minimal, Working Test code to reproduce the issue.

// master.js

const Bull = require('bull');
const queue = new Bull("html_pusher", { redis: { "port": port, "host": "ip", "db": 0, "showFriendlyErrorStack": true, "password": "pwd" } });

const proc = require('./child.js');
queue.process(1, proc);
// child.js
module.exports = proc;

async function proc(job, done) {
  console.log(`HI JOB ${job.id}`);
  console.log(job);
  job.data.foo = 'bar';
  await job.update(job.data);
  return done();
}

when I convert the processor call to a separate process the job.update throws the error

// master.js

const Bull = require('bull');
const queue = new Bull("html_pusher", { redis: { "port": port, "host": "ip", "db": 0, "showFriendlyErrorStack": true, "password": "pwd" } });

queue.process(__dirname + "/child.js");

Bull version

3.4.8

Additional information

This is the content of job when processor is within the master process:

Job {
  opts:
   { attempts: 1,
     delay: 0,
     timestamp: 1555080724183,
     backoff: undefined },
  name: '__default__',
  queue:
   Queue {
     name: 'html_pusher',
     token: '641dc8a5-7722-4015-a464-06c268685617',
     keyPrefix: 'bull',
     clients: [ [Object], [Object], [Object] ],
     _initializing: Promise { undefined },
     handlers: { __default__: [AsyncFunction: bound proc] },
     processing: [ [Object] ],
     retrieving: 0,
     drained: false,
     settings:
      { lockDuration: 30000,
        stalledInterval: 30000,
        maxStalledCount: 1,
        guardInterval: 5000,
        retryProcessDelay: 5000,
        drainDelay: 5,
        backoffStrategies: {},
        lockRenewTime: 15000 },
     _events: { error: [Function] },
     _eventsCount: 1,
     timers: TimerManager { idle: false, listeners: [], timers: [Object] },
     moveUnlockedJobsToWait: [Function: bound ],
     processJob: [Function: bound ],
     getJobFromId: [Function: bound ],
     keys:
      { '': 'bull:html_pusher:',
        active: 'bull:html_pusher:active',
        wait: 'bull:html_pusher:wait',
        waiting: 'bull:html_pusher:waiting',
        paused: 'bull:html_pusher:paused',
        resumed: 'bull:html_pusher:resumed',
        'meta-paused': 'bull:html_pusher:meta-paused',
        id: 'bull:html_pusher:id',
        delayed: 'bull:html_pusher:delayed',
        priority: 'bull:html_pusher:priority',
        'stalled-check': 'bull:html_pusher:stalled-check',
        completed: 'bull:html_pusher:completed',
        failed: 'bull:html_pusher:failed',
        stalled: 'bull:html_pusher:stalled',
        repeat: 'bull:html_pusher:repeat',
        limiter: 'bull:html_pusher:limiter',
        drained: 'bull:html_pusher:drained',
        progress: 'bull:html_pusher:progress' },
     delayedTimestamp: 1.7976931348623157e+308,
     _initializingProcess: Promise { undefined },
     errorRetryTimer: {},
     registeredEvents: { delayed: [Object] },
     guardianTimer:
      Timeout {
        _called: true,
        _idleTimeout: 5000,
        _idlePrev: [Object],
        _idleNext: [Object],
        _idleStart: 30565,
        _onTimeout: [Function],
        _timerArgs: undefined,
        _repeat: 5000,
        _destroyed: false,
        [Symbol(asyncId)]: 116,
        [Symbol(triggerAsyncId)]: 0 },
     moveUnlockedJobsToWaitInterval:
      Timeout {
        _called: true,
        _idleTimeout: 30000,
        _idlePrev: [Object],
        _idleNext: [Object],
        _idleStart: 30650,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: 30000,
        _destroyed: false,
        [Symbol(asyncId)]: 135,
        [Symbol(triggerAsyncId)]: 0 } },
  data:
   {
... my data ...
},
  _progress: 0,
  delay: 0,
  timestamp: 1555080724183,
  stacktrace: [],
  returnvalue: null,
  attemptsMade: 0,
  toKey: [Function: wrapper],
  id: '6604614',
  processedOn: 1555080725310,
  failedReason: undefined }

This is the content of job when job runs in a separate process:

{ id: '6604006',
  name: '__default__',
  data:
   { 
.... my data ....
  },
opts: { attempts: 1, delay: 0, timestamp: 1555080466092 },
progress: [Function],
  delay: 0,
  timestamp: 1555080466092,
  attemptsMade: 0,
  stacktrace: [],
  returnvalue: null,
  finishedOn: null,
  processedOn: 1555080467236 }

It seems that when the job is in a separate process some properties are missing.

Assignee
Assign to
Time tracking