felixmosh / bull-board

🎯 Queue background jobs inspector
MIT License
2.36k stars 366 forks source link

Clean all job is not working #807

Closed kumarmanishc closed 3 weeks ago

kumarmanishc commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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

kumarmanishc commented 2 months ago

@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 commented 2 months ago

Just added this scenario :]

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

felixmosh commented 2 months ago

@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 commented 1 month ago

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

felixmosh commented 1 month ago

@CyrilCartoux can you make a small reproduction repo?

CyrilCartoux commented 1 month ago

@CyrilCartoux can you make a small reproduction repo?

I will :)

CyrilCartoux commented 1 month ago

@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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

Are you using bull or bullmq?

kumarmanishc commented 1 month ago

I'm using bullmQ

On Wed, 16 Oct 2024 at 10:13, Felix Mosheev @.***> wrote:

Are you using bull or bullmq?

— Reply to this email directly, view it on GitHub https://github.com/felixmosh/bull-board/issues/807#issuecomment-2415719409, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGBBA27QYOSRJZ36HWA4PQ3Z3XVGRAVCNFSM6AAAAABNQGW3X2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMJVG4YTSNBQHE . You are receiving this because you authored the thread.Message ID: @.***>

-- Manish Kumar Chaubey

Email : @.***

LinkedIn : https://www.linkedin.com/in/kumarmanishc

Medium : https://kumarmanishc.medium.com/

Twitter : https://www.twitter.com/kumarmanishc

felixmosh commented 1 month ago

Are you using the correct queue adapter?

piszczu4 commented 1 month ago

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 commented 1 month ago

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

cyc1e commented 3 weeks ago

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)

Hi, it would be great Because its not obviously. Exception in this flow is a good solution.

felixmosh commented 3 weeks ago

Added queue <-> adapter compatebility, use v6.3.2