diff --git a/Source/FikaAmazonAPI/Services/RequestService.cs b/Source/FikaAmazonAPI/Services/RequestService.cs index accaab42..e4cf7b59 100644 --- a/Source/FikaAmazonAPI/Services/RequestService.cs +++ b/Source/FikaAmazonAPI/Services/RequestService.cs @@ -214,7 +214,7 @@ private void RestHeader() cancellationToken.ThrowIfCancellationRequested(); - AmazonCredential.UsagePlansTimings[rateLimitType].Delay(); + await AmazonCredential.UsagePlansTimings[rateLimitType].Delay(); tryCount++; } } diff --git a/Source/FikaAmazonAPI/Utils/RateLimits.cs b/Source/FikaAmazonAPI/Utils/RateLimits.cs index f08d34b1..de20624f 100644 --- a/Source/FikaAmazonAPI/Utils/RateLimits.cs +++ b/Source/FikaAmazonAPI/Utils/RateLimits.cs @@ -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()); } } }