Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: [ANSWERED] How to use the rate limiter

$
0
0
Hi,

Tweetinvi contains a RateLimit awaiter since version 0.9.6.0.
// When performing a query, the RateLimitAwaiter will await for the RateLimits to be available before executing a query.
RateLimit.RateLimitTrackerOption = RateLimitTrackerOptions.TrackAndAwait;

// The RateLimitAwaiter only update the cache RateLimits and let you handle them on your own.
RateLimit.RateLimitTrackerOption = RateLimitTrackerOptions.TrackOnly;

// Use the QueryBeforeExecute to handle the RateLimit and do what you want with it
TweetinviEvents.QueryBeforeExecute += (sender, args) =>
{
    var queryRateLimit = RateLimit.GetQueryRateLimit(args.QueryURL);

    if (queryRateLimit != null&& queryRateLimit.Remaining == 0)
    {
        RateLimit.AwaitForQueryRateLimit(queryRateLimit);
    }
};
Linvi

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>