Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions worker/src/docker/taskbridge/file_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ pub async fn handle_file_upload(
anyhow::anyhow!("Failed to upload file to S3 after {} attempts", MAX_RETRIES)
}))
}

/// Handles a file validation request
pub async fn handle_file_validation(
file_sha: &str,
Expand All @@ -338,7 +337,6 @@ pub async fn handle_file_validation(

let mut retry_count = 0;
let mut last_error = None;

info!(
"Starting blockchain work submission with max {} retries",
MAX_RETRIES
Expand Down Expand Up @@ -397,23 +395,36 @@ pub async fn handle_file_validation(
)
.await
{
Ok(inner_result) => match inner_result {
Ok(r) => {
info!("Successfully submitted work to blockchain: {:?}", r);
return Ok(());
Ok(inner_result) => {
match inner_result {
Ok(r) => {
info!("Successfully submitted work to blockchain: {:?}", r);
return Ok(());
}
Err(e) => {
let error_msg = e.to_string();
error!("Failed to submit work: {}", error_msg);

// Check if the error is because work was already submitted
// Currently a workaround as this is not reproducible
if error_msg.contains("Work already submitted") {
info!("Work was already submitted successfully, considering this a success");
info!("This can happen when multiple nodes process the same file or if this node retried a successful submission");
return Ok(());
}

last_error = Some(anyhow::anyhow!("Failed to submit work: {}", e));
retry_count += 1;
continue;
}
}
Err(e) => {
error!("Failed to submit work: {}", e);
last_error = Some(anyhow::anyhow!("Failed to submit work: {}", e));
retry_count += 1;
continue;
}
},
}
Err(_) => {
error!(
"Timeout while submitting work to blockchain (after {} seconds)",
TRANSACTION_TIMEOUT_SECS
);

last_error = Some(anyhow::anyhow!(
"Blockchain transaction timeout after {} seconds",
TRANSACTION_TIMEOUT_SECS
Expand Down