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

Only clean up pastes which exist #219

Merged
merged 1 commit into from
Sep 1, 2024
Merged

Conversation

tacerus
Copy link
Member

@tacerus tacerus commented Sep 1, 2024

If pastes would be deleted administratively before the scheduled expiry cleanup took place, the cleanup job would, once the schedule hit, return "Error performing PastesCleanupJob" along with a long traceback about the failure.
Handle the situation gracefully and avoid the failure by validating whether the paste exists before attempting to delete it.
To achieve this, the paste ID instead of the paste object must be passed to the job, as otherwise the object in the queue might no longer be pointing to any valid paste, not allowing for validation of it inside the function.

https://progress.opensuse.org/issues/166121

@coveralls
Copy link

coveralls commented Sep 1, 2024

Pull Request Test Coverage Report for Build 10653381576

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.972%

Totals Coverage Status
Change from base Build 9600752377: 0.0%
Covered Lines: 265
Relevant Lines: 282

💛 - Coveralls

app/jobs/pastes_cleanup_job.rb Outdated Show resolved Hide resolved
app/jobs/pastes_cleanup_job.rb Outdated Show resolved Hide resolved
If pastes would be deleted administratively before the scheduled expiry
cleanup took place, the cleanup job would, once the schedule hit,
return "Error performing PastesCleanupJob" along with a long traceback
about the failure.
Handle the situation gracefully and avoid the failure by validating whether
the paste exists before attempting to delete it.
To achieve this, the paste ID instead of the paste object must be passed
to the job, as otherwise the object in the queue might no longer be
pointing to any valid paste, not allowing for validation of it inside the
function.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
@hellcp hellcp merged commit 621ed26 into openSUSE:main Sep 1, 2024
2 checks passed
@tacerus tacerus deleted the cleanupjob branch September 1, 2024 10:53
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.

3 participants