protected virtual bool CanContinue() { bool isQueueEmpty = _eventQueue.CountQueueItems() == 0; int actualDispatches = _dispatchQueue.CountQueueItems(); int maxDispatches = _dispatchQueue.PersistBeginOnItemsCount; bool isDispatchQueueFull = actualDispatches >= maxDispatches; return(!isQueueEmpty && !isDispatchQueueFull && _hubState.State == SwitchState.Started); }
protected virtual bool CheckIsQueryRequired() { bool isEmpty = _eventQueue.CountQueueItems() == 0; if (!isEmpty) { return(false); } bool storageUpdated = _changeNotifier != null && _changeNotifier.HasUpdates; DateTime nextQueryTimeUtc = _lastQueryTimeUtc + QueryPeriod; bool doScheduledQuery = nextQueryTimeUtc <= DateTime.UtcNow; return(storageUpdated || doScheduledQuery || _isLastQueryMaxItemsReceived); }