Fix large blocked users list preventing login (#175)
* Remove await from get blocked users * Implement request limit to blocked users
This commit is contained in:
parent
d2c57921b8
commit
08d476d11e
2 changed files with 10 additions and 1 deletions
|
|
@ -410,6 +410,12 @@ class TwitchApi {
|
|||
final result = blockedList.map((e) => UserBlockedTwitch.fromJson(e)).toList();
|
||||
|
||||
if (cursor != null) {
|
||||
// Wait a bit (150 milliseconds) before recursively calling.
|
||||
// This will prevent going over the rate limit to due a massive blocked users list.
|
||||
//
|
||||
// With the Twitch API, we can make up to 800 requests per minute.
|
||||
// Waiting 150 milliseconds between requests will cap the rate here at 400 requests per minute.
|
||||
await Future.delayed(const Duration(milliseconds: 150));
|
||||
result.addAll(await getUserBlockedList(id: id, cursor: cursor, headers: headers));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue