Skip to content

Commit

Permalink
fix: Allow event retries even if initial request fails to connect (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored Jul 30, 2024
1 parent 8b5e18e commit a9c0150
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions launchdarkly-server-sdk/src/events/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ where
}
};

for attempt in 0..2 {
if attempt == 1 {
for attempt in 1..=2 {
if attempt == 2 {
sleep(Duration::from_secs(1)).await;
}

Expand All @@ -134,6 +134,7 @@ where

let response = match result {
Ok(response) => response,
Err(_) if attempt == 1 => continue,
Err(e) => {
// It appears this type of error will not be an HTTP error.
// It will be a closed connection, aborted write, timeout, etc.
Expand Down

0 comments on commit a9c0150

Please sign in to comment.