Beispiel #1
0
 private void WorkProvider_MovalChangedOrAdded(TsdbVolumeMoval <TKey> moval)
 {
     lock ( _scheduledWork )
     {
         TsdbScheduledMoval <TKey, TEntry> work;
         if (_scheduledWork.TryGetValue(moval.Id, out work))
         {
             work.Reschedule(moval);
         }
         else
         {
             work = new TsdbScheduledMoval <TKey, TEntry>(this, moval);
             _scheduledWork.Add(moval.Id, work);
             work.Schedule();
         }
     }
 }
Beispiel #2
0
        public async Task StartAsync()
        {
            var movals = await _workProvider.GetAllMovalsAsync(DateTime.UtcNow).ConfigureAwait(false);

            lock ( _scheduledWork )
            {
                foreach (var moval in movals)
                {
                    var work = new TsdbScheduledMoval <TKey, TEntry>(this, moval);
                    _scheduledWork.Add(moval.Id, work);
                    work.Schedule();
                }
            }

            var scheduleTime = DateTime.UtcNow + _workProvider.GetTemporaryMovalInterval();

            _unsubscribe = _scheduler.AddCommand(scheduleTime, MoveTemporaryData);

            _workProvider.MovalChangedOrAdded += WorkProvider_MovalChangedOrAdded;
            _workProvider.MovalRemoved        += WorkProvider_MovalRemoved;
        }