Not able to rate limit bull queue

1.5k views Asked by At

in order to manage the traffic and effectively process a particular message, / we have implemented a rate limited bull queue :- but we are not able to acheive rate limiting . Here is my implementation , but rate limiting in this queue is not working

const createNewQueue = async({ queueName, queueOpts = {}, defaultJobOpts = null, queueUrl = null }) =>{
try{
    console.log("createNewQueue fn called")
    if(defaultJobOpts){
        queueOpts.defaultJobOptions = defaultJobOpts
    }
    queueOpts['redis'] ={
      port:process.env.CS_REDIS_PORT,
      host:process.env.CS_REDIS_URL,
      password:process.env.CS_REDIS_PASSWORD
    }
    queueUrl = queueUrl ? queueUrl : redisUrl
    const newQueue = new Queue(queueName , queueOpts )
    console.log("\n\n\n queue created ------\n", newQueue)
    Queues[queueName] = newQueue
    return newQueue
}
catch(err){
    handleAppError({err})
}

}

const inputQueue = {
queueName: 'inputQueue',
processLeftJobs: true,
processOptions: {
  concurrency: 1
},
cleanQueue: true,
cleanQueueEvents: [
  'completed'
],
queueOpts:{
  limiter: {
    max: 1000,
    duration: 10000
  }
}

}

await createNewQueue(inputQueue)
0

There are 0 answers