Skip to content

Commit dbeb48d

Browse files
committed
fix limit to debug mode only
1 parent 07ad506 commit dbeb48d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Source/FikaAmazonAPI/AmazonConnection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ private void Init(AmazonCredential Credentials)
139139
this._FulFillmentOutbound = new FulFillmentOutboundService(this.Credentials);
140140
this._VendorDirectFulfillmentOrders = new VendorDirectFulfillmentOrderService(this.Credentials);
141141
this._VendorOrders = new VendorOrderService(this.Credentials);
142+
143+
AmazonCredential.DebugMode = this.Credentials.IsDebugMode;
142144
}
143145
private void ValidateCredentials(AmazonCredential Credentials)
144146
{

Source/FikaAmazonAPI/AmazonCredential.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class AmazonCredential
2424
public string MarketPlaceID { get; set; }
2525
public string SellerID { get; set; }
2626
public string ProxyAddress { get; set; }
27-
27+
public static bool DebugMode { get; set; }
2828
public AmazonCredential()
2929
{
3030
CacheTokenData = new CacheTokenData();

Source/FikaAmazonAPI/Utils/RateLimits.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ public RateLimits NextRate(RateLimitType rateLimitType)
2828

2929
var nextRequestsSent = RequestsSent + 1;
3030
var nextRequestsSentTxt = (nextRequestsSent > Burst) ? "FULL" : nextRequestsSent.ToString();
31-
string output = $"[RateLimits ,{rateLimitType,15}]: {DateTime.UtcNow.ToString(),10}\t Request/Burst: {nextRequestsSentTxt}/{Burst}\t Rate: {Rate}/{ratePeriodMs}ms";
32-
Console.WriteLine(output);
31+
if (AmazonCredential.DebugMode)
32+
{
33+
string output = $"[RateLimits ,{rateLimitType,15}]: {DateTime.UtcNow.ToString(),10}\t Request/Burst: {nextRequestsSentTxt}/{Burst}\t Rate: {Rate}/{ratePeriodMs}ms";
34+
Console.WriteLine(output);
35+
}
36+
3337

3438

3539
if (RequestsSent >= Burst)

0 commit comments

Comments
 (0)