BoxKite.Twitter.TwitterConnection.GetHomeTimeLine_Backfill C# (CSharp) Метод

GetHomeTimeLine_Backfill() приватный Метод

private GetHomeTimeLine_Backfill ( ) : Task
Результат Task
        private async Task<long> GetHomeTimeLine_Backfill()
        {
            long smallestid = 0;
            long largestid = 0;
            int backfillQuota = 50;
            int backofftimer = 30;

            do
            {
                var hometl = await UserSession.GetHomeTimeline(count: _pagingSize, maxId: smallestid);
                if (hometl.OK)
                {
                    smallestid = long.MaxValue;
                    if (hometl.Count < backfillQuota) backfillQuota = hometl.Count;
                    foreach (var tweet in hometl)
                    {
                        if (tweet.Id < smallestid) smallestid = tweet.Id;
                        if (tweet.Id > largestid) largestid = tweet.Id;
                        AddToHomeTimeLine(tweet);
                        backfillQuota--;
                    }
                    await Task.Delay(_multiFetchBackoffTimer);
                }
                else
                {
                    // The Backoff will trigger 7 times before just giving up
                    // once at 30s, 60s, 1m, 2m, 4m, 8m and then 16m
                    // note that the last call into this will be 1m above the 15 "rate limit reset" window 
                    await Task.Delay(TimeSpan.FromSeconds(backofftimer));
                    if (backofftimer > _maxbackoff)
                        break;
                    backofftimer = backofftimer * 2;
                }
            } while (backfillQuota > 0);
            return largestid;
        }