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

add support for deferred tasks #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

add support for deferred tasks #71

wants to merge 1 commit into from

Conversation

dmitsh
Copy link
Collaborator

@dmitsh dmitsh commented Jun 20, 2024

This feature allows to submit deferred tasks from the code based of certain events and conditions.
For example, we want to kill a job 30 seconds after it started.
We don't know when the job is scheduled, but we have an informer.
Once the informer recognizes the job, it will submit a deferred "DeleteJob" task that will kick off in 30 seconds and delete the job.

@dmitsh dmitsh force-pushed the ds-defer branch 3 times, most recently from ed0e929 to 9a61109 Compare June 21, 2024 00:45
executor executor
queue *utils.ChronoQueue
next time.Time
timer *time.Timer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of maintaining a timer and a queue independently, would it be possible to subsume the timer into the queue?

That is, can we have something similar to DelayingQueue which has an AddAfter function. This function will add the item to the queue after the delay has passed. The queue has a blocking get function that can be used to get the required objects at the correct time.

@lalitadithya
Copy link
Collaborator

Can you please add an example YAML file that uses the new functionality?

@dmitsh dmitsh force-pushed the ds-defer branch 3 times, most recently from 90ee2d8 to 5510f7d Compare June 29, 2024 03:35
Signed-off-by: Dmitry Shmulevich <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants