Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gedi rate limiter modifications #280

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions FortnoxSDK/Connectors/Base/BaseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ namespace Fortnox.SDK.Connectors.Base;
internal abstract class BaseClient
{
public ErrorHandler ErrorHandler { get; set; }
public RateLimiter RateLimiter { get; set; }
public static RateLimiter RateLimiter { get; set; }
public HttpClient HttpClient { get; set; }

public bool UseRateLimiter { get; set; } = true;
public FortnoxAuthorization Authorization { get; set; }

protected BaseClient()
static BaseClient()
{
RateLimiter = new RateLimiter();
}

protected BaseClient()
{
ErrorHandler = new ErrorHandler();
}

Expand Down
4 changes: 2 additions & 2 deletions FortnoxSDK/Connectors/Base/RateLimiter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Fortnox.SDK.Connectors.Base;
/// </summary>
internal class RateLimiter
{
private const int MaxCount = 4;
private static readonly TimeSpan Period = TimeSpan.FromSeconds(1);
private const int MaxCount = 10;
private static readonly TimeSpan Period = TimeSpan.FromSeconds(5);

private static readonly Dictionary<string, TimeLimiter> RateLimiters = new();

Expand Down
Loading