Skip to content

Commit

Permalink
tasks: skip health checks for files that don't have a uri
Browse files Browse the repository at this point in the history
* these files will fail with certainty because there is no on-disk file
  on which to calculate the MD5 checksum
  • Loading branch information
max-moser committed Mar 3, 2025
1 parent 397671a commit 60fe2a0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions invenio_app_rdm/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
def file_integrity_report():
"""Send a report of uhealthy/missing files to system admins."""
# First retry verifying files that errored during their last check
files = FileInstance.query.filter(FileInstance.last_check.is_(None))
files = FileInstance.query.filter(
FileInstance.last_check.is_(None),
FileInstance.uri.is_not(None),
)
for f in files:
try:
f.clear_last_check()
Expand All @@ -32,7 +35,8 @@ def file_integrity_report():
FileInstance.query.filter(
sa.or_(
FileInstance.last_check.is_(None), FileInstance.last_check.is_(False)
)
),
FileInstance.uri.is_not(None),
)
.order_by(FileInstance.created.desc())
.all()
Expand Down

0 comments on commit 60fe2a0

Please sign in to comment.