Skip to content

Commit

Permalink
Check up/downstreams are currently up before complaining too badly
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Dec 17, 2024
1 parent 97f2dd3 commit 7f05523
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions librarian_background/hypervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,15 @@ def handle_stale_outgoing_transfer(

return False

client = downstream_librarian.client()
try:
client = downstream_librarian.client()
client.ping()
except (LibrarianHTTPError, LibrarianTimeoutError) as e:
logger.info(
"Downstream librarian {} is unreachable, skipping for now",
downstream_librarian.name,
)
return False

expected_file_name = transfer.file.name
expected_file_checksum = transfer.file.checksum
Expand Down Expand Up @@ -204,7 +212,15 @@ def handle_stale_incoming_transfer(

# We have an upstream librarian. We can ask it about the status of its
# own OutgoingTransfer.
client = upstream_librarian.client()
try:
client = upstream_librarian.client()
client.ping()
except (LibrarianHTTPError, LibrarianTimeoutError) as e:
logger.info(
"Upstream librarian {} is unreachable, skipping for now",
upstream_librarian.name,
)
return False

status_request = CheckinStatusRequest(
source_transfer_ids=[transfer.source_transfer_id],
Expand Down

0 comments on commit 7f05523

Please sign in to comment.