Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean all job is not working #807

Open
kumarmanishc opened this issue Sep 2, 2024 · 18 comments
Open

Clean all job is not working #807

kumarmanishc opened this issue Sep 2, 2024 · 18 comments

Comments

@kumarmanishc
Copy link

Thank you for this awesome package..
As of #39 we have a feature to remove all failed jobs.

That's not working
It's requesting to the following endpoints but not working at all with empty response

How to produce ?

It's showing the clean all button.
image
Once user clicks on that it's making request to the following URL
PUT: Request with empty response] http://localhost:3000/bullmq/api/queues/**queue_name**/clean/failed

Note: However Individual remove request is working but it's difficult to remove jobs individually

@felixmosh
Copy link
Owner

It do work for me... Weird, there is a limit of the underline lib(bull / bullmq) of 1000 at a time...
Does your failed queue counter decrease by 1000?

@felixmosh
Copy link
Owner

felixmosh commented Sep 3, 2024

hi @smoothdvd,
can you make a small repo that recreates your issue? I've tried the empty function locally, it works as expected.
Can you check the queue name, maybe there is some issue with the path (which includes the queue name).
Make sure that you are using the correct queue adapter (for bullmq, use BullmqAdapter)
I'm more than happy to try to debug it with you, I'm available on Discord, felixmosh

@smoothdvd
Copy link

@felixmosh Sorry, it's my fault. Using BullAdapter on bullMQ queue.

@kumarmanishc
Copy link
Author

@felixmosh I tried even with less than 100 jobs something migh be wrong with queue system.

Have created queue like this
export const queue1 = new Queue(QueueName.Queue1, { connection: redisConnection });
export const Queue2 = new Queue(QueueName.Queue2, { connection: redisConnection });

@felixmosh
Copy link
Owner

Just added this scenario :]

@felixmosh Sorry, it's my fault. Using BullAdapter on bullMQ queue.

@felixmosh
Copy link
Owner

@felixmosh I tried even with less than 100 jobs something migh be wrong with queue system.

Have created queue like this export const queue1 = new Queue(QueueName.Queue1, { connection: redisConnection }); export const Queue2 = new Queue(QueueName.Queue2, { connection: redisConnection });

can you make a small repo that recreated that issue?

@CyrilCartoux
Copy link

Hi, interested in the solution. I have the same problem

@felixmosh
Copy link
Owner

@CyrilCartoux can you make a small reproduction repo?

@CyrilCartoux
Copy link

@CyrilCartoux can you make a small reproduction repo?

I will :)

@CyrilCartoux
Copy link

@CyrilCartoux can you make a small reproduction repo?

Felix I have created the repo ;)
Let me know if any questions!
https://github.com/CyrilCartoux/bull-board-807

@felixmosh
Copy link
Owner

felixmosh commented Oct 14, 2024

Thank you @CyrilCartoux, I've managed to reproduce your issue.
The problem is that you are using a BullAdapter instead of BullMQAdapter, with bullMQ lib.

Maybe it is time for me to stop this shananigan... and throw an Exception.

(I've tested the change, and it works)

@CyrilCartoux
Copy link

Damn you're right !

Sorry about that! And thanks a lot for the fast replies!! Keep up the good work mate we use a lot your package ;)

@piszczu4
Copy link

I have the same issue. I'm using nestjs like this:

// part of app.module

   BullModule.forRootAsync({
      imports: [ConfigModule],
      useFactory: (configService: ConfigService<IConfiguration>) => ({
        redis: {
          host: configService.get('redis.host', { infer: true }),
          port: configService.get('redis.port', { infer: true }),
          username: configService.get('redis.username', { infer: true }),
          password: configService.get('redis.password', { infer: true }),
          ...(configService.get('redis.tls', { infer: true }) ? { tls: {} } : {}),
          retryStrategy: (times) => (times > 3 ? undefined : 5000),
        },
      }),
      inject: [ConfigService],
    }),
    BullBoardModule.forRootAsync({
      imports: [ConfigModule],
      useFactory: (configService: ConfigService<IConfiguration>) => ({
        route: '/queues',
        adapter: ExpressAdapter,
        middleware: (req, res, next) => {
          const authHeader = req.headers.authorization || '';
          const [authType, credentials] = authHeader.split(' ');

          if (authType === 'Basic' && credentials) {
            const decoded = Buffer.from(credentials, 'base64').toString('utf8');
            const [inputUsername, inputPassword] = decoded.split(':');

            if (
              inputUsername === configService.get('bull.dashboard.username', { infer: true }) &&
              inputPassword === configService.get('bull.dashboard.password', { infer: true })
            ) {
              return next();
            }
          }

          res.setHeader('WWW-Authenticate', 'Basic realm="Bull Dashboard"');
          res.status(401).send('Authentication required.');
        },
      }),
      inject: [ConfigService],
    }),

And for example FileModule:

@Module({
  imports: [
    TypeOrmModule.forFeature([FileEntity, BoughtCourseEntity, CourseEntity]),
    UploadModule,
    BullModule.registerQueue({ name: videoMetadataQueue }, { name: tempFilesQueue }),
    BullBoardModule.forFeature(
      {
        name: videoMetadataQueue,
        adapter: BullMQAdapter,
      },
      {
        name: tempFilesQueue,
        adapter: BullMQAdapter,
      },
    ),
  ],
  providers: [FileService, VideoMetadataProcessor, TempFilesProcessor],
  controllers: [FileController],
  exports: [FileService],
})
export class FileModule {}

I can remove a single job but not all of them. Any ideas?

@felixmosh
Copy link
Owner

Are you using bull or bullmq?

@kumarmanishc
Copy link
Author

kumarmanishc commented Oct 16, 2024 via email

@felixmosh
Copy link
Owner

Are you using the correct queue adapter?

@piszczu4
Copy link

piszczu4 commented Oct 16, 2024

I refactored my code from using bull to bullmq and it seems to work, at least the option clean all, while empty option on the right does not work - any ideas why? Earlier there was an error internal server error but now there is no error but no action as well

image

@felixmosh
Copy link
Owner

I'm not sure, without a reproduction repo I can't help much...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants