Skip to content

Commit

Permalink
Merge pull request #188 from fzyzcjy/patch-1
Browse files Browse the repository at this point in the history
Fix bug for Backoff when many attempts: "UnsupportedError: Unsupported operation: Infinity or NaN toInt"
  • Loading branch information
jumperchen authored May 6, 2021
2 parents 154798c + da0be99 commit 224ed90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ class _Backoff {
/// @api public
///
num get duration {
var ms = _ms * math.pow(_factor, attempts++);
var ms = math.min(_ms * math.pow(_factor, attempts++), 1e100);
if (_jitter > 0) {
var rand = math.Random().nextDouble();
var deviation = (rand * _jitter * ms).floor();
Expand Down

0 comments on commit 224ed90

Please sign in to comment.