Coder Social home page Coder Social logo

Comments (5)

MichielvdVelde avatar MichielvdVelde commented on August 18, 2024 2

I'm getting the same error. I believe I have traced it to RedisConnection.waitUntilReady():

static async waitUntilReady(client: IORedis.Redis) {
return new Promise(function(resolve, reject) {
if (client.status === 'ready') {
resolve();
} else {
async function handleReady() {
client.removeListener('error', handleError);
await load(client);
resolve();
}

I am providing the queue with a connected and ready connection. As such, the scripts are never loaded as handleReady() (and thus load) is never executed. I'm imagining what is required is some way of determining whether the scripts are loaded, and if not, load them before resolving the Promise.

The only two workarounds I have discovered so far are using a fresh Redis connection for every queue, or I will need to manually call load on the connection before passing it on. Not a major hassle, but possibly unexpected behavior nonetheless.

Edit: perhaps superfluously, a snippet of how I worked around this issue:

import IORedis from 'ioredis'
import { load, Queue } from 'bullmq'

const connection = new IORedis()

connection.once('ready', async () => {
  await load(connection)
  const queue = new Queue('name', { connection })
  // ...
})

Edit 2: Possibly related to #108 as well
Edit 3: I just noticed #59

from bullmq.

manast avatar manast commented on August 18, 2024

try with this change:

export async function addToQueue(queueName: string, data: any): void {
  await queues[queueName].waitUntilReady();
  return queues[queueName].add(queueName, data);
}

from bullmq.

manast avatar manast commented on August 18, 2024

I will leave this open because waitUntilReady should not be necessary, we overlooked it.

from bullmq.

mgan59 avatar mgan59 commented on August 18, 2024

I got jammed up by this issue, my implementation has a generator that fans out my tasks. Worked fine locally. But my deployment has a limit on redis-connections which blew up my worker. I figured I'd just share the redis connection which is when I started having error. The solution on issue #59 helped get me over the bump. Just an FYI to anyone else that lands here.

from bullmq.

manast avatar manast commented on August 18, 2024

🎉 This issue has been resolved in version 1.8.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

from bullmq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.