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 completed task pruning feature #8

Merged
merged 5 commits into from
Oct 5, 2023

Conversation

furosa
Copy link
Contributor

@furosa furosa commented Oct 4, 2023

Add prune_completed_tasks method. This method deletes from the task_queue postgres table all tasks completed more than the specified hours ago; tasks being processed, not started or completed recently will stay in the table.

@furosa furosa force-pushed the add-completed-task-pruning branch from 199775b to 1cdfed7 Compare October 4, 2023 15:55
@furosa furosa force-pushed the add-completed-task-pruning branch from 1cdfed7 to 8ce2130 Compare October 4, 2023 16:08
@jacopofar
Copy link
Member

Thanks! I like it, but I'd prefer to use seconds for the interval to keep consistency with the lease timeout, and current_timestamp instead of now() as it's standard SQL (it does the same thing, it's just nicer to see for me).

so, basically:

                       AND completed_at < current_timestamp - CAST(
                            %s || ' seconds' AS INTERVAL);

and the corresponding change in the documentation

@jacopofar
Copy link
Member

There's some linting issue

@furosa
Copy link
Contributor Author

furosa commented Oct 5, 2023

There's some linting issue

Thanks for the heads up, it should be fixed!

@jacopofar jacopofar merged commit e7988e6 into flix-tech:main Oct 5, 2023
6 checks passed
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