Skip to content

Commit

Permalink
We already download the body, just add it to the result
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverb123 committed Aug 9, 2024
1 parent 037509e commit c1421c7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions rust/hook-worker/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,10 @@ async fn process_webhook_job<W: WebhookJob>(

match request_error {
WebhookRequestError::RetryableRequestError {
error, retry_after, ..
error,
retry_after,
response, // Grab the response so we can send it back to hog for debug
..
} => {
let retry_interval =
retry_policy.retry_interval(webhook_job.attempt() as u32, retry_after);
Expand Down Expand Up @@ -623,7 +626,7 @@ async fn process_webhook_job<W: WebhookJob>(
Some(status) => Ok(WebhookResult::BadResponse(WebhookResponse {
duration: now.elapsed(),
status_code: status,
body: None,
body: response,
})),
None => Ok(WebhookResult::Error(error.to_string())),
}
Expand All @@ -634,7 +637,9 @@ async fn process_webhook_job<W: WebhookJob>(
}
}
}
WebhookRequestError::NonRetryableRetryableRequestError { error, .. } => {
WebhookRequestError::NonRetryableRetryableRequestError {
error, response, ..
} => {
webhook_job
.fail(webhook_job_error)
.await
Expand All @@ -649,7 +654,7 @@ async fn process_webhook_job<W: WebhookJob>(
Some(status) => Ok(WebhookResult::BadResponse(WebhookResponse {
duration: now.elapsed(),
status_code: status,
body: None,
body: response,
})),
None => Ok(WebhookResult::Error(error.to_string())),
}
Expand Down

0 comments on commit c1421c7

Please sign in to comment.