Skip to content

Commit

Permalink
fix: die if retries is zero (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
geofmureithi authored Jul 12, 2024
1 parent 369d8ec commit d70e479
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/layers/retry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ where
None
}
Err(_) if (self.retries - ctx.current() > 0) => Some(future::ready(self.clone())),
Err(_) if self.retries == 0 => None,
Err(_) => None,
}
}
Expand Down

2 comments on commit d70e479

@kdesjard
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This crashes with a "attempt to subtract with overflow"

I think this:

            Err(_) if self.retries == 0 => None,

should come before:

            Err(_) if (self.retries - ctx.current() > 0) => Some(future::ready(self.clone())),

@geofmureithi
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for highlighting this

Please sign in to comment.