Skip to content

[Bug]: upsertJobSchedule does not apply change on existing scheduled job #3500

@dangtran47

Description

@dangtran47

Version

5.61.0

Platform

NodeJS

What happened?

upsertJobScheduler does not update existing job

How to reproduce.

  await dailyArchiveManager.getQueue().upsertJobScheduler(
        'daily-archive-recurring',
        {
          pattern: '*/1 * * * *', 
          offset: 0,
          tz: 'America/New_York',
        },
        {
          opts: {
            attempts: 3,
            removeOnFail: true,
            repeatJobKey: 'daily-archive-recurring',
          },
          data: {
            timestamp: new Date().toISOString(),
            triggeredBy: 'schedule',
            // targetDate will be calculated in the processor
          },
          name: 'daily-archive-task',
        },
      );

Then change the pattern.

  await dailyArchiveManager.getQueue().upsertJobScheduler(
        'daily-archive-recurring',
        {
          pattern: '* 8 * * *', // <<<<<<<<<<
          offset: 0,
          tz: 'America/New_York',
        },
        {
          opts: {
            attempts: 3,
            removeOnFail: true,
            repeatJobKey: 'daily-archive-recurring',
          },
          data: {
            timestamp: new Date().toISOString(),
            triggeredBy: 'schedule',
            // targetDate will be calculated in the processor
          },
          name: 'daily-archive-task',
        },
      );

I can see that the data is updated through the Bull dashboard, but the schedule still isn't updated until the existing task is run.

Image

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions