0

为了管理流量并有效处理特定消息,/我们实施了限速公牛队列:-但我们无法实现限速。这是我的实现,但此队列中的速率限制不起作用

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)
4

0 回答 0