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] - Support for Long-Running, One-Time Jobs with Start/Stop Controls #612

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

Comments

@CR7273868
Copy link

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.

@CR7273868 CR7273868 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
@JohnRoesler JohnRoesler removed the v2 label May 24, 2024
@JohnRoesler JohnRoesler changed the title Feature Request: Support for Long-Running, One-Time Jobs with Start/Stop Controls [FEATURE] - Support for Long-Running, One-Time Jobs with Start/Stop Controls May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants