question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RateLimiters don't seem to like the GeneralApi.SubAccount.AddIpToWhitelistForApiKeyAsync method

See original GitHub issue

Describe the bug When trying to use the GeneralApi.SubAccount.AddIpToWhitelistForApiKeyAsync Method, the RateLimiter fails with the following error “Sequence contains no elements” and stack trace

System.InvalidOperationException: at System.Linq.ThrowHelper.ThrowNoElementsException (System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a) at CryptoExchange.Net.Objects.RateLimiter+<ProcessTopic>d__9.MoveNext (CryptoExchange.Net, Version=5.1.1.0, Culture=neutral, PublicKeyToken=null) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at CryptoExchange.Net.Objects.RateLimiter+<LimitRequestAsync>d__8.MoveNext (CryptoExchange.Net, Version=5.1.1.0, Culture=neutral, PublicKeyToken=null) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at CryptoExchange.Net.BaseRestClient+<SendRequestAsync>d__231.MoveNext (CryptoExchange.Net, Version=5.1.1.0, Culture=neutral, PublicKeyToken=null) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Binance.Net.Clients.GeneralApi.BinanceClientGeneralApi+<SendRequestInternal>d__211.MoveNext (Binance.Net, Version=8.0.3.0, Culture=neutral, PublicKeyToken=null) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1+ConfiguredTaskAwaiter.GetResult (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at Binance.Net.Clients.GeneralApi.BinanceClientGeneralApiSubAccount+<AddIpToWhitelistForApiKeyAsync>d__55.MoveNext (Binance.Net, Version=8.0.3.0, Culture=neutral, PublicKeyToken=null) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e) at ClintUX.Controllers.UserController+<IPAdd>d__5.MoveNext (ClintUX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\Users\andre\source\repos\ClintMethod\ClintUX\Controllers\UserController.cs:137)

To Reproduce Use a TotalRateLimiter and try to add an IP address to the whitelist of a given binance account. If RateLimiters list is left empty the request is successfull

Expected behavior The Request completes successfully

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JKorfcommented, Mar 4, 2022

Each request has a specific weight, most just weigh 1, but the AddIpToWhitelistForApiKeyAsync request has a weight of 3000.

The 1200 limit is for /api/ endpoints, the /sapi/ endpoints which the whitelist is part of has a limit of 12000, see https://binance-docs.github.io/apidocs/spot/en/#limits

0reactions
andresdrbcommented, Mar 4, 2022

Jesús Christ, I didn’t expect the weight of that one to be 3k 😳 makes sense now

Enviado desde mi iPhone

El 4 mar 2022, a las 10:28, Jan Korf @.***> escribió:

The rate limiter assumes that a request has been made before since it has reached the rate limit, but in your case the limit is reached without a prior request in memory, so it throws an exception

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async requests over an API with request rate limiter
I tried some solutions like rate-limiter of NodeJS, but it just generate 10 requests simultaneously, and didn't give any kind of error treatment ......
Read more >
Rate limit APIs · Issue #52079 · dotnet/runtime
This is the most general way to provide additional information since the RateLimiter can add any arbitrary type or collections via object State ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found