diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-08-06 23:53:29 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-06 23:53:29 +0200 |
| commit | 796eeb2cda3d498ddaf0b312a6cadeddd107c539 (patch) | |
| tree | 847b27f2708b9739f959baa277c9cc33efba9fbd | |
| parent | 8964697d8b8620f56a9485376b56b13a01d44ed0 (diff) | |
| parent | 268139c435eab7c880d8d20069dadae043928013 (diff) | |
Merge pull request #3836 from cvium/remove_tmdb_api_rate_limit
Remove rate limit from TMDb provider
| -rw-r--r-- | MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs index 74870c999..27ab6756f 100644 --- a/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs +++ b/MediaBrowser.Providers/Plugins/Tmdb/Movies/TmdbMovieProvider.cs @@ -406,26 +406,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies return mainResult; } - private static long _lastRequestTicks; - // The limit is 40 requests per 10 seconds - private const int RequestIntervalMs = 300; - /// <summary> /// Gets the movie db response. /// </summary> internal async Task<HttpResponseInfo> GetMovieDbResponse(HttpRequestOptions options) { - var delayTicks = (RequestIntervalMs * 10000) - (DateTime.UtcNow.Ticks - _lastRequestTicks); - var delayMs = Math.Min(delayTicks / 10000, RequestIntervalMs); - - if (delayMs > 0) - { - _logger.LogDebug("Throttling Tmdb by {0} ms", delayMs); - await Task.Delay(Convert.ToInt32(delayMs)).ConfigureAwait(false); - } - - _lastRequestTicks = DateTime.UtcNow.Ticks; - options.BufferContent = true; options.UserAgent = _appHost.ApplicationUserAgent; |
