Exemplo n.º 1
0
        public System.Threading.Tasks.Task ExecuteAsync(CancellationToken cancellationToken)
        {
            var dataHandler = new ReindexBinariesDataHandler(new DataOptions(), _connectionStrings);
            var taskHandler = new ReindexBinariesTaskManager(dataHandler);

            if (_enabled == null)
            {
                _enabled = taskHandler.IsFeatureActive();
                if (!_enabled.Value)
                {
                    WaitingSeconds = 600000;
                }
                else
                {
                    _timeLimit = taskHandler.GetTimeLimit();
                }
            }
            if (!_enabled.Value)
            {
                return(System.Threading.Tasks.Task.CompletedTask);
            }

            var finished = taskHandler.GetBackgroundTasksAndExecute(_timeLimit);

            if (finished)
            {
                Tracer.Write("All binaries are re-indexed.");
                taskHandler.InactivateFeature();
                Tracer.Write("ReindexBinaries feature is destroyed.");
            }

            return(System.Threading.Tasks.Task.CompletedTask);
        }
Exemplo n.º 2
0
 public ReindexBinariesTaskManager(ReindexBinariesDataHandler dataHandler)
 {
     _dataHandler = dataHandler;
 }