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

Feature Request: Support for Long-Running, One-Time Jobs with Start/Stop Controls #612

Open
Demy076 opened this issue Nov 11, 2023 · 1 comment
Labels
enhancement New feature or request v2

Comments

@Demy076
Copy link

Demy076 commented Nov 11, 2023

Is your feature request related to a problem? Please describe
I'm experiencing challenges with managing long-running jobs that only need to run once and require frequent start/stop interventions, potentially from an external trigger like a Discord command. The current workaround using every(1).seconds().limitrunsto(1) feels cumbersome and somewhat unreliable, especially for jobs that have longer runtimes. Think about premature exits from job context done channel.

Describe the solution you'd like
I would like a feature that allows for more intuitive handling of these types of jobs. Ideally, this feature would enable a job to start and stop based on external triggers while ensuring that it runs to completion unless explicitly cancelled. This would involve better integration with job context, allowing for graceful handling of job.ctx.Done() without premature termination.

Describe alternatives you've considered
The current alternative involves using a combination of every(1).seconds().limitrunsto(1) and manual intervention, but this is not optimal for our use case. It lacks the finesse and control required for efficiently managing long-running, one-time jobs.

Additional context
This feature would be particularly useful in scenarios where jobs are controlled by non-technical team members or through automated triggers from various platforms like Discord. It would enhance the flexibility and usability of gocron in more complex job scheduling scenarios.

@Demy076 Demy076 added the enhancement New feature or request label Nov 11, 2023
@JohnRoesler
Copy link
Contributor

JohnRoesler commented Dec 21, 2023

Hey @Demy076

This may notcompletely solve your request - but v2 now has OneTimeJobs.

With this you could trigger your runs, and then if failed, run again with Job.RunNow -> example

@JohnRoesler JohnRoesler added the v2 label Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v2
Projects
None yet
Development

No branches or pull requests

2 participants