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
  • #954
Closed
Open
Issue created May 22, 2018 by Administrator@rootContributor

Problem with loading separate processors

Created by: artem-a

Description

When we set a separate processor without a file extension, we have no errors, but the processor does not work in version 3.4.2 (this is work in version 3.4.1).

Perhaps the system should throw an error message or load the processor without the file extension?

Minimal, Working Test code to reproduce the issue.

server.js

'use strict'

const path = require('path')
const Queue = require('bull')

const procPath = (...args) => path.resolve(__dirname, 'processors', ...args)

const blocksQueue = new Queue('blocks-queue')

blocksQueue.process('new-block', 20, procPath('blocks-new')) // works only for 3.4.1
// blocksQueue.process('new-block', 20, procPath('blocks-new.js'))

blocksQueue.on('completed', (job, result) => {
  console.log('completed')
  console.log(result)
})

process.on('SIGINT', () => {
  blocksQueue.close()
  process.exit(0)
})

console.log('start job server')

worker.js

'use strict'

const Queue = require('bull')

const blocksQueue = new Queue('blocks-queue')

blocksQueue
  .on('global:completed', (jobId, result) => {
    console.log('global:completed')
    console.log(result)
  })

setInterval(() => {
  const data = { num: Math.random() }
  const opts = { removeOnComplete: true }
  blocksQueue.add('new-block', data, opts)
}, 2000)

process.on('SIGINT', () => {
  blocksQueue.close()
  process.exit(0)
})

processors/blocks-new.js

'use strict'

module.exports = async (job, done) => {
  const result = await Promise.resolve(job.data.num)
  done(null, { result })
}

Bull version

3.4.1, 3.4.2

Additional information

you need to run in separate terminals node server.js & node worker.js

Assignee
Assign to
Time tracking