public void UpdateServiceStatus(QueueControllerStatus status) { if (status == null) { Clients.Caller.updateServiceStatus(null); return; } var controller = Globals.Controller.Controllers .FirstOrDefault(ct => ct.QueueName == status.queueName); if (controller == null) { return; } controller.WaitInterval = status.waitInterval; controller.QueueName = status.queueName; // Max 50 threads controller.ThreadCount = status.threadCount; if (controller.ThreadCount > 50) { controller.ThreadCount = 50; status.threadCount = 50; } var config = QueueMessageManagerConfiguration.Current; // grab the individual controller var controllerConfig = config.Controllers .FirstOrDefault(ct => ct.QueueName == status.queueName); if (config == null) { return; } controllerConfig.ControllerThreads = controller.ThreadCount; controllerConfig.WaitInterval = controller.WaitInterval; controllerConfig.QueueName = status.queueName; // try to save config settings //config.Write(); Task.Delay(2000).ContinueWith(x => config.Write()); controller.StopProcessing(); controller.StartProcessingAsync(); StatusMessage("Service Status settings updated.", true); // update all clients with the status information Clients.All.updateControllerStatusCallback(status); }
public void UpdateServiceStatus(QueueControllerStatus status) { if (status == null) { Clients.Caller.updateServiceStatus(null); return; } var controller = Globals.Controller.Controllers .FirstOrDefault(ct => ct.QueueName == status.queueName); if (controller == null) return; controller.WaitInterval = status.waitInterval; controller.QueueName = status.queueName; // Max 50 threads controller.ThreadCount = status.threadCount; if (controller.ThreadCount > 50) { controller.ThreadCount = 50; status.threadCount = 50; } var config = QueueMessageManagerConfiguration.Current; // grab the individual controller var controllerConfig = config.Controllers .FirstOrDefault(ct => ct.QueueName == status.queueName); if (config == null) return; controllerConfig.ControllerThreads = controller.ThreadCount; controllerConfig.WaitInterval = controller.WaitInterval; controllerConfig.QueueName = status.queueName; // try to save config settings //config.Write(); Task.Delay(2000).ContinueWith(x => config.Write()); controller.StopProcessing(); controller.StartProcessingAsync(); StatusMessage("Service Status settings updated.", true); // update all clients with the status information Clients.All.updateControllerStatusCallback(status); }