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] setTime() starts the job even if the job was stopped #598

Closed
TaccolaA opened this issue Feb 10, 2022 · 2 comments Β· Fixed by #661
Closed

[BUG] setTime() starts the job even if the job was stopped #598

TaccolaA opened this issue Feb 10, 2022 · 2 comments Β· Fixed by #661
Labels

Comments

@TaccolaA
Copy link

⭐ Suggestion

In 1.8.2, cronjob.setTime() stops the job and change the time but doesn't automatically starts the job back.
It would be nice to start it automatically, maybe checking first if it was running before.

πŸ’» Use Cases

We sometimes want to change the cron expression of a running job. We have to call start() again which is a bit counter intuitive.

❌ Related Problems

On master, it looks like the setTime method already starts back the job after changing the time.
I can see the last release is from 2 years ago, is there any plan for a new release ?

@oh2th
Copy link

oh2th commented Feb 4, 2023

setTime() now starts the job, even if it was already stopped. Should not restart if job wasn't running.
Suggest there would be more logic in setTime() to check if job is running or not before setting the time.

@intcreator intcreator changed the title [FEATURE] Make setTime automatically restart job / New release [BUG] setTime() starts the job even if the job was stopped Apr 6, 2023
sheerlox added a commit to sheerlox/node-cron that referenced this issue Apr 14, 2023
sheerlox added a commit to sheerlox/node-cron that referenced this issue Apr 14, 2023
sheerlox added a commit to sheerlox/node-cron that referenced this issue Apr 16, 2023
intcreator pushed a commit that referenced this issue Apr 22, 2023
ncb000gt pushed a commit that referenced this issue Jul 24, 2023
## [2.4.0](v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](d8a2f14))

### πŸ› Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](7e26c23))

### πŸ›  Builds

* **npm:** ship type definitions with releases ([0b663a8](0b663a8))

### 🚨 Tests

* add test case for [#598](#598) fix ([4322ef2](4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](f0d5d3f))

### βš™οΈ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
* wrap setTime tests in describe and move down ([31989e0](31989e0))
@ncb000gt
Copy link
Member

ncb000gt commented Jul 24, 2023

πŸŽ‰ This issue has been resolved in version 2.3.1 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

patrickm68 added a commit to patrickm68/node-cron-types that referenced this issue Sep 14, 2023
## [2.4.0](kelektiv/node-cron@v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](kelektiv/node-cron@d8a2f14))

### πŸ› Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](kelektiv/node-cron@7e26c23))

### πŸ›  Builds

* **npm:** ship type definitions with releases ([0b663a8](kelektiv/node-cron@0b663a8))

### 🚨 Tests

* add test case for [#598](kelektiv/node-cron#598) fix ([4322ef2](kelektiv/node-cron@4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](kelektiv/node-cron@f0d5d3f))

### βš™οΈ Continuous Integrations

* add support for beta & maintenance releases ([#677](kelektiv/node-cron#677)) ([c6fc842](kelektiv/node-cron@c6fc842))
* setup conventional commits & release automation ([#673](kelektiv/node-cron#673)) ([c6f39ff](kelektiv/node-cron@c6f39ff))

### ♻️ Chores

* update default branch name ([#678](kelektiv/node-cron#678)) ([7471e95](kelektiv/node-cron@7471e95))
* wrap setTime tests in describe and move down ([31989e0](kelektiv/node-cron@31989e0))
sheerlox pushed a commit that referenced this issue Sep 27, 2023
## [2.4.0](v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](d8a2f14))

### πŸ› Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](7e26c23))

### πŸ›  Builds

* **npm:** ship type definitions with releases ([0b663a8](0b663a8))

### 🚨 Tests

* add test case for [#598](#598) fix ([4322ef2](4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](f0d5d3f))

### βš™οΈ Continuous Integrations

* add support for beta & maintenance releases ([#677](#677)) ([c6fc842](c6fc842))
* setup conventional commits & release automation ([#673](#673)) ([c6f39ff](c6f39ff))

### ♻️ Chores

* update default branch name ([#678](#678)) ([7471e95](7471e95))
* wrap setTime tests in describe and move down ([31989e0](31989e0))
sheerlox pushed a commit to sheerlox/node-cron that referenced this issue Sep 27, 2023
## [2.4.0](kelektiv/node-cron@v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](kelektiv@d8a2f14))

### πŸ› Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](kelektiv@7e26c23))

### πŸ›  Builds

* **npm:** ship type definitions with releases ([0b663a8](kelektiv@0b663a8))

### 🚨 Tests

* add test case for [kelektiv#598](kelektiv#598) fix ([4322ef2](kelektiv@4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](kelektiv@f0d5d3f))

### βš™οΈ Continuous Integrations

* add support for beta & maintenance releases ([kelektiv#677](kelektiv#677)) ([c6fc842](kelektiv@c6fc842))
* setup conventional commits & release automation ([kelektiv#673](kelektiv#673)) ([c6f39ff](kelektiv@c6f39ff))

### ♻️ Chores

* update default branch name ([kelektiv#678](kelektiv#678)) ([7471e95](kelektiv@7471e95))
* wrap setTime tests in describe and move down ([31989e0](kelektiv@31989e0))
sheerlox pushed a commit to sheerlox/node-cron that referenced this issue Sep 29, 2023
## [2.4.0](kelektiv/node-cron@v2.3.0...v2.4.0) (2023-07-24)

### ✨ Features

* import type definitions from [@types](https://github.com/types)/cron ([d8a2f14](kelektiv@d8a2f14))

### πŸ› Bug Fixes

* don't start job in setTime if it wasn't running ([7e26c23](kelektiv@7e26c23))

### πŸ›  Builds

* **npm:** ship type definitions with releases ([0b663a8](kelektiv@0b663a8))

### 🚨 Tests

* add test case for [kelektiv#598](kelektiv#598) fix ([4322ef2](kelektiv@4322ef2))
* don't stop/start job before using setTime ([f0d5d3f](kelektiv@f0d5d3f))

### βš™οΈ Continuous Integrations

* add support for beta & maintenance releases ([kelektiv#677](kelektiv#677)) ([c6fc842](kelektiv@c6fc842))
* setup conventional commits & release automation ([kelektiv#673](kelektiv#673)) ([c6f39ff](kelektiv@c6f39ff))

### ♻️ Chores

* update default branch name ([kelektiv#678](kelektiv#678)) ([7471e95](kelektiv@7471e95))
* wrap setTime tests in describe and move down ([31989e0](kelektiv@31989e0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants