nestjs bullmq issue with async cleanup
07:45 31 Dec 2025

I have nestjs application, I try to do the following: when calling some endpoint on my app I add some job to the queue, before returning the jobId I also hsset some data in my redis (to contain some metadata about the job operation).

later on the processor I want to handle the job operation and upon completion - delete the metadata I previously added.

my process function looks like this:

  async process(job: Job) {
    switch (job.name) {
      case JOBS.save:
        const data = await this.handleSave(job.data, job.id)
        await cleanup(job.id, job.data.userId)
        return data;
      default:
        throw new Error(`Unknown job: ${job.name}`);
    }
  }

however for some reason data is returned but for long jobs (~12 mins active) cleanup function doesn't run..

any ideas ?

redis nestjs bullmq