Skip to content

Commit

Permalink
fix: Allow event retries even if initial request fails to connect
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 committed Jul 30, 2024
1 parent 8b5e18e commit 580021b
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 580021b

Please sign in to comment.