How do you handle api rate limits?

Yeah, it automatically does the work for you. If the server restarts, then you need to create new queues instances for waiting and delayed jobs, and then it will just continue with the same limits.

Just make sure your redis db is persistent.

I just wrote a script that gets all the queues with waiting or delayed jobs:

async function connectToRedis() {
  const redis = new ioredis({
    host: process.env.REDIS_HOST,
    port: process.env.REDIS_PORT,
    password: process.env.REDIS_PASSWORD,
    user: process.env.REDIS_USER,
  });

  await redis.connect();
  console.log("Connected to Redis cluster");
  
  let cursor = "0";
  const pattern = "bull:*";
  const queueNames = [];
  while (cursor !== "0") {
    const res = await redis.scan(cursor, "MATCH", pattern, "COUNT", 100);
    cursor = res[0];
    const keys = res[1];
    keys.forEach((key) => {
      const [, type, name] = key.split(":");
      if (type === "delayed" || type === "waiting") {
        queueNames.push(name);
      }
    });
  }
  
  return JSON.stringify(queueNames);
}

You can use this to trigger the script after a server restart: