public void IntervalSignal(IScheduled <RetryGappedEntries <T> > scheduled, RetryGappedEntries <T> data)
        {
            var gappedReader      = data.GappedReader;
            var fillups           = gappedReader(data.GappedEntries.GapIds);
            var nextGappedEntries = data.GappedEntries.FillupWith(fillups);

            if (!nextGappedEntries.ContainsGaps || !data.MoreRetries)
            {
                var eventually = data.GappedEntries.CompletesEventually;
                if (nextGappedEntries.Count == 1)
                {
                    // Only one entry has to be returned.
                    eventually.With(nextGappedEntries.GetFirst().OrElse(null !));
                }
                else
                {
                    eventually.With(nextGappedEntries.SortedLoadedEntries);
                }
            }
            else
            {
                var nextData = data.NextRetry(nextGappedEntries);
                Scheduler.ScheduleOnce(scheduled, nextData, TimeSpan.Zero, data.RetryInterval);
            }
        }
Example #2
0
        public void ReadGaps(GappedEntries <T> gappedEntries, int retries, TimeSpan retryInterval, Func <List <long>, List <IEntry <T> > > gappedReader)
        {
            var entries = new RetryGappedEntries <T>(gappedEntries, 1, retries, retryInterval, gappedReader);

            _scheduler.ScheduleOnce(_actor, entries, TimeSpan.Zero, retryInterval);
        }