Skip to content

Commit

Permalink
Do not instantiate multiple Random instances (#996)
Browse files Browse the repository at this point in the history
  • Loading branch information
watfordgnf authored Mar 19, 2021
1 parent 9ebafbd commit 0cd0971
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ internal class SqlFixedIntervalEnumerator : SqlRetryIntervalBaseEnumerator
{
private readonly int maxRandom;
private readonly int minRandom;
private readonly Random random = new Random();

public SqlFixedIntervalEnumerator(TimeSpan gapTimeInterval, TimeSpan maxTimeInterval, TimeSpan minTimeInterval)
: base(gapTimeInterval, maxTimeInterval, minTimeInterval)
Expand All @@ -94,7 +95,6 @@ public SqlFixedIntervalEnumerator(TimeSpan gapTimeInterval, TimeSpan maxTimeInte

protected override TimeSpan GetNextInterval()
{
var random = new Random();
Current = TimeSpan.FromMilliseconds(random.Next(minRandom, maxRandom));
return Current;
}
Expand Down

0 comments on commit 0cd0971

Please sign in to comment.