Skip to content

Commit

Permalink
New: Rate limiting for Trakt connection
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Dec 15, 2023
1 parent c9e977b commit cc0a448
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/NzbDrone.Core/Notifications/Trakt/TraktProxy.cs
@@ -1,3 +1,4 @@
using System;
using System.Net.Http;
using NLog;
using NzbDrone.Common.Extensions;
Expand Down Expand Up @@ -76,6 +77,7 @@ public TraktAuthRefreshResource RefreshAuthToken(string refreshToken)
{
var request = new HttpRequestBuilder(RenewUri)
.AddQueryParam("refresh_token", refreshToken)
.WithRateLimit(2)
.Build();

return _httpClient.Get<TraktAuthRefreshResource>(request)?.Resource ?? null;
Expand All @@ -85,6 +87,7 @@ public HttpRequest BuildRequest(string resource, HttpMethod method, string acces
{
var request = new HttpRequestBuilder(URL).Resource(resource).Build();

request.RateLimit = TimeSpan.FromSeconds(2);
request.Headers.Accept = HttpAccept.Json.Value;
request.Method = method;

Expand Down

0 comments on commit cc0a448

Please sign in to comment.