Skip to content

Only clean up pastes which exist#219

Merged
hellcp merged 1 commit intoopenSUSE:mainfrom
tacerus:cleanupjob
Sep 1, 2024
Merged

Only clean up pastes which exist#219
hellcp merged 1 commit intoopenSUSE:mainfrom
tacerus:cleanupjob

Conversation

@tacerus
Copy link
Copy Markdown
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
Copy Markdown

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

Comment thread app/jobs/pastes_cleanup_job.rb Outdated
Comment thread app/jobs/pastes_cleanup_job.rb Outdated
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
@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