private void _handleMessageStartUpdatingSystems(object sender, NetworkMessageContainer messageData) { var data = messageData?.MessageData as MessageStartUpdatingSystems; // Return if this isn't the target slave if (data.SlaveServerID != _mySlaveID) { return; } PSystemsLoaded = false; if (data.ClearCurrentSystems) { _galaxyManager.ClearLocalSystems(); } #if DEBUG Stopwatch s1 = new Stopwatch(); s1.Start(); #endif var loadedSystemModels = _databaseManager.GetAreasAsync(data.IDsToSimulate).Result; foreach (PSystemModel p in loadedSystemModels) { PSystem s = Deserializer.DeserializePSystemAsync(p, _redisServer, _locatorService, _registrationManager, _databaseManager).Result; } foreach (var a in _galaxyManager.AllAreas) { //Clear existing subscriptions to prevent doubles (for hot loading) _redisServer.UnSubscribe(ChannelTypes.WebToSlave, a.Value.Id, _routedMessageProcessor); //Subscribe _redisServer.Subscribe(ChannelTypes.WebToSlave, a.Value.Id, _routedMessageProcessor); } #if DEBUG ConsoleManager.WriteLine(_galaxyManager.AllAreas.Count.ToString() + " total areas currently loaded.", ConsoleMessageType.Debug); s1.Stop(); ConsoleManager.WriteLine(s1.ElapsedMilliseconds + " ms to load " + _galaxyManager.Systems.Count + " systems.", ConsoleMessageType.Debug); #endif PSystemsLoaded = true; }