Esempio n. 1
0
        public void UpdateAll()
        {
            try
            {
                using (var serv = new SpringieService())
                {
                    serv.Timeout = 5000;
                    var configs = serv.GetClusterConfigs(Config.ClusterNode);

                    lock (autoHosts)
                    {
                        foreach (var conf in configs)
                        {
                            if (!autoHosts.Any(x => x.config.Login == conf.Login))
                            {
                                SpawnAutoHost(conf, null);
                            }
                            else
                            {
                                foreach (var ah in autoHosts.Where(x => x.config.Login == conf.Login && x.SpawnConfig == null))
                                {
                                    ah.config = conf;
                                }
                            }
                        }
                        var todel = autoHosts.Where(x => !configs.Any(y => y.Login == x.config.Login)).ToList();
                        foreach (var ah in todel)
                        {
                            StopAutohost(ah);
                        }
                    }
                }
            }
            catch (Exception ex) {
                Trace.TraceError("Error in periodic updates: {0}", ex);
            }
        }