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
  • #2041
Closed
Open
Issue created May 07, 2021 by Administrator@rootContributor

Failed stalled jobs don't fire global:failed event

Created by: svet93

The issue is that today when a job stalls more than the allowed number of times, it gets moved to failed, but the event doesn't get published. We noticed that because we were running a job that would start other child jobs and use the .finished() function in order to know when the work is done. However, if a job stalled, it never ended in the global:failed handler so the finished function never resolved.

it('should emit global:failed when a job has stalled more than allowable times', done => {
  queue.on('completed', (/*job*/) => {
    done(new Error('should not have completed'));
  });

  queue.process((/*job*/) => {
    return delay(250);
  });

  queue.add({ foo: 'bar' });

  const queue2 = utils.buildQueue('test events', {
    settings: {
      stalledInterval: 100,
      maxStalledCount: 0
    }
  });

  queue2.on('global:failed', (/*job*/) => {
    queue2.close().then(done);
  });

  queue.on('active', () => {
    queue2.startMoveUnlockedJobsToWait();
    queue.close(true);
  });
});
Assignee
Assign to
Time tracking