You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not resetting _requestsThisBurst meant that after 30 calls to the Reddit API you would only be able to make one call per minute. I fixed this by resetting _requestsThisBurst to 0 when _burstStart is reset.
Not making the method synchronized meant that there existed a race condition where more than 30 requests would be transmitted every 60 seconds. This can be exhibited by printing _requestsThisBurst on every EnforceRateLimit call and making a demo program that calls the API many times in parallel, for example
```var posts = reddit.GetSubreddit("askreddit").Hot.Take(100);
Parallel.ForEach(posts, post =>
{
var topCommentAuthor = post.Comments.FirstOrDefault().Author
});```
0 commit comments