Skip to content

Commit

Permalink
Merge pull request abuzuhri#735 from ismkdc/bugfix/non-block-delay
Browse files Browse the repository at this point in the history
Dont block when waiting a rate limit
  • Loading branch information
abuzuhri authored Jun 4, 2024
2 parents 199e185 + 2e81100 commit ad37a14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Source/FikaAmazonAPI/Services/RequestService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private void RestHeader()

cancellationToken.ThrowIfCancellationRequested();

AmazonCredential.UsagePlansTimings[rateLimitType].Delay();
await AmazonCredential.UsagePlansTimings[rateLimitType].Delay();
tryCount++;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/FikaAmazonAPI/Utils/RateLimits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ internal void SetRateLimit(decimal rate)
Rate = rate;
}

internal void Delay()
internal Task Delay()
{
Task.Delay(GetRatePeriodMs()).Wait();
return Task.Delay(GetRatePeriodMs());
}
}
}

0 comments on commit ad37a14

Please sign in to comment.