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

[Bug]: Issue with updating job template data with upsertJobScheduler #2940

Closed
1 task done
erkkaha opened this issue Nov 27, 2024 · 3 comments
Closed
1 task done

[Bug]: Issue with updating job template data with upsertJobScheduler #2940

erkkaha opened this issue Nov 27, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@erkkaha
Copy link

erkkaha commented Nov 27, 2024

Version

5.29.1

Platform

NodeJS

What happened?

I have problem updating data with upsertJobScheduler.

With pattern the data is not updated. Data stays the same with each run.

With every the data is updated but for some reason the value of every is not respected
unless prevMillis is defined.

How to reproduce.

import { Queue, Worker } from "bullmq";

// Create a new connection in every instance
const myQueue = new Queue("myqueue", { connection: { host: "localhost" } });

const myWorker = new Worker(
  "myqueue",
  async (job: { data: any }) => {
    console.log(job.data);
    return upsert();
  },
  { connection: { host: "localhost" } }
);

const upsert = async () =>
  await myQueue.upsertJobScheduler(
    "my-scheduler-id",
    { pattern: "*/1 * * * *" },
    //{ every: 15000 },
    {
      name: "my-job-name",
      data: { ts: Date.now() },
      opts:{
        // prevMillis: Date.now()
      }
    }
  );

upsert();

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@roggervalf
Copy link
Collaborator

hi @erkkaha, for the second case

With every the data is updated but for some reason the value of every is not respected
unless prevMillis is defined

it's because every option starts the first execution immediately by default when using job-schedulers

@erkkaha
Copy link
Author

erkkaha commented Nov 28, 2024

@roggervalf ok, Thanks for the reply. This seems to be the case regardless if immediately is used or not. Is this by design?

@roggervalf
Copy link
Collaborator

hey @erkkaha, yes that's by design. If you don't need to start a job immediately as every does. You can use pattern option with '*/15 * * * * *' expression as cron-parser supported cron expressions considering seconds as well https://www.npmjs.com/package/cron-parser. Let us know if that works for your case

github-actions bot pushed a commit that referenced this issue Nov 29, 2024
# [5.30.0](v5.29.1...v5.30.0) (2024-11-29)

### Bug Fixes

* **job-scheduler:** upsert template when same pattern options are provided ([#2943](#2943)) ref [#2940](#2940) ([b56c3b4](b56c3b4))

### Features

* **queue:** add getDelayedCount method [python] ([#2934](#2934)) ([71ce75c](71ce75c))
* **queue:** add getJobSchedulersCount method ([#2945](#2945)) ([38820dc](38820dc))
@manast manast closed this as completed Dec 2, 2024
alexandresoro pushed a commit to alexandresoro/ouca that referenced this issue Dec 4, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [bullmq](https://bullmq.io/) ([source](https://github.com/taskforcesh/bullmq)) | dependencies | minor | [`5.29.1` -> `5.31.1`](https://renovatebot.com/diffs/npm/bullmq/5.29.1/5.31.1) |

---

### Release Notes

<details>
<summary>taskforcesh/bullmq (bullmq)</summary>

### [`v5.31.1`](https://github.com/taskforcesh/bullmq/releases/tag/v5.31.1)

[Compare Source](taskforcesh/bullmq@v5.31.0...v5.31.1)

##### Bug Fixes

-   **scheduler-template:** remove console.log when getting template information ([#&#8203;2950](taskforcesh/bullmq#2950)) ([3402bfe](taskforcesh/bullmq@3402bfe))

### [`v5.31.0`](https://github.com/taskforcesh/bullmq/releases/tag/v5.31.0)

[Compare Source](taskforcesh/bullmq@v5.30.1...v5.31.0)

##### Features

-   **queue:** enhance getJobScheduler method to include template information ([#&#8203;2929](taskforcesh/bullmq#2929)) ref [#&#8203;2875](taskforcesh/bullmq#2875) ([cb99080](taskforcesh/bullmq@cb99080))

### [`v5.30.1`](https://github.com/taskforcesh/bullmq/releases/tag/v5.30.1)

[Compare Source](taskforcesh/bullmq@v5.30.0...v5.30.1)

##### Bug Fixes

-   **flow:** allow using removeOnFail and failParentOnFailure in parents ([#&#8203;2947](taskforcesh/bullmq#2947)) fixes [#&#8203;2229](taskforcesh/bullmq#2229) ([85f6f6f](taskforcesh/bullmq@85f6f6f))

### [`v5.30.0`](https://github.com/taskforcesh/bullmq/releases/tag/v5.30.0)

[Compare Source](taskforcesh/bullmq@v5.29.1...v5.30.0)

##### Bug Fixes

-   **job-scheduler:** upsert template when same pattern options are provided ([#&#8203;2943](taskforcesh/bullmq#2943)) ref [#&#8203;2940](taskforcesh/bullmq#2940) ([b56c3b4](taskforcesh/bullmq@b56c3b4))

##### Features

-   **queue:** add getDelayedCount method \[python] ([#&#8203;2934](taskforcesh/bullmq#2934)) ([71ce75c](taskforcesh/bullmq@71ce75c))
-   **queue:** add getJobSchedulersCount method ([#&#8203;2945](taskforcesh/bullmq#2945)) ([38820dc](taskforcesh/bullmq@38820dc))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xNDIuNyIsInVwZGF0ZWRJblZlciI6IjM4LjE0Mi43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Reviewed-on: https://git.tristess.app/alexandresoro/ouca/pulls/361
Reviewed-by: Alexandre Soro <code@soro.dev>
Co-authored-by: renovate <renovate@git.tristess.app>
Co-committed-by: renovate <renovate@git.tristess.app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants