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

autoupdate: check if PR is first when running update operation #103

Merged
merged 2 commits into from
Feb 29, 2024
Merged

Conversation

fho
Copy link
Contributor

@fho fho commented Feb 28, 2024

It can happen that the Update operations is run for multiple PRs instead of only
the first one in the active queue.
An example is that multiple update operations are queued in
the go-routine pool. The first run is running for PR #1, the queued one is for PR #2.
If PR #2 gets suspended, the update operation is still queued.
When a PR is suspended the update operation is only canceled if it is
also first in the queue and has been started.

To prevent it, updatePR() now checks if the PR for that it runs is the first one
in the active queue, otherwise it does nothing.
It also now checks if it's context is canceled, in the beginning, to prevent
unnecessary function calls

A better solution would be to change the go routine pool, to be able to remove
operations for the queue via the PR identifier. This would allow to always
remove updatePR operations when a PR gets suspended.

fho added 2 commits February 28, 2024 18:43
It can happen that the Update operations is run for multiple PRs instead of only
the first one in the active queue.
An example is that multiple update operations are queued in
the go-routine pool. The first run is running for PR #1, the queued one is for PR #2.
If PR #2 gets suspended, the update operation is still queued.
When a PR is suspended the update operation is only canceled if it is
also first in the queue and has been started.

To prevent it, updatePR() now checks if the PR for that it runs is the first one
in the active queue, otherwise it does nothing.
It also now checks if it's context is canceled, in the beginning, to prevent
unnecessary function calls

A better solution would be to change the go routine pool, to be able to remove
operations for the queue via the PR identifier. This would allow to always
remove updatePR operations when a PR gets suspended.
@fho fho self-assigned this Feb 28, 2024
@fho fho marked this pull request as ready for review February 29, 2024 09:30
@fho fho merged commit 430fc09 into main Feb 29, 2024
5 checks passed
@fho fho deleted the resume_fix branch February 29, 2024 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant