Ejemplo n.º 1
0
 private void DisconnectWorker(WorkerStatus worker)
 {
     _workers.Remove(worker);
     _workerTimers.Remove(worker.Key);
     _logger.Info(worker + " disconnected");
     OnWorkerDisconnected(worker);
 }
Ejemplo n.º 2
0
        public async Task UpdateWorker(WorkerStatus workerUpdate)
        {
            var worker = _workers.SingleOrDefault(w => w.Key == workerUpdate.Key);

            if (worker == default(WorkerStatus))
            {
                // add to repository of workers
                _workers.Add(workerUpdate);

                // start timer
                _workerTimers.Add(workerUpdate.Key, 0);

                OnWorkerConnected(workerUpdate);

                _logger.Info(workerUpdate + " connected");
            }
            else
            {
                // reset timer
                _workerTimers[workerUpdate.Key] = 0;
            }
        }