denoland / denoland/deploy_feedback

Unable to modify cron schedule without redeploying

Open
#714 1 comment 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
79
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### What problem are you trying to solve?

I am working on a project where I would like to use the Deno Cron functionality, but I encountered a limitation. You cannot modify or stop a cron job once it has been set. There may be a way to do this, but I couldn't figure it out.

### Describe the solution you'd like

It would be really useful if you could at least stop a cron job, allowing you to create a new one. I have two examples here of how this could look like.

### Example 1
```js
const task = Deno.cron("Cron job", "*/30 * * * * *", () => { ... });
task.stop()
```

### Example 2
```js
const task = Deno.stopCron("Cron job")
```

### Describe alternatives you've considered

I tried changing the schedule by setting one with the same name, but then resulted in this error: Uncaught TypeError: Cron with this name already exists. I will also be checking out [Croner](https://croner.56k.guru) to see if it gets the job done for me.

```js
Deno.cron("Cron job", "*/30 * * * * *", () => {
console.log("Cron job ran, every 30 seconds");
});

const changeCron = () => {
Deno.cron("Cron job, "*/45 * * * *", () => {
console.log("Cron job ran, every 45 seconds");
});
};
```

### Documentation, Adoption, Migration Strategy

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.