public void UpdateConfiguration(R.Config.Update.IUpdatePackage pkg) { try { ApplyConfiguration(pkg); } catch (Exception ex) { Log.LogWarning("----------------------Configuration update failed: {msg}", ex.Message); #if DEBUG throw ex; #endif } }
List <IEndPoint> EndPoints(R.Config.Update.IUpdatePackage pkg) { List <IEndPoint> res = new List <IEndPoint>(); foreach (var p in pkg.PackageFiles.Where(x => x.Status == PackageFileStatus.AnalyzedReady)) { var c = ComponentFactory.Create(p.Config); DbService.AddCollection("user", "id"); var ep = new RestEndPoint() { Uri = p.Config.Uri, Component = c, Method = p.Config.Method }; res.Add(ep); } return(res); }
void ApplyConfiguration(R.Config.Update.IUpdatePackage pkg) { lock (lockObj) { Log.LogInformation("Begin of configuration update: " + DateTime.Now); if (pkg.Unpack(this.LastUpdateTime)) { RoutingTableService.ReplaceEndPoints(EndPoints(pkg)); GC.Collect(); LastUpdateTime = DateTime.Now; Log.LogInformation("Configuration update completed. No errors."); } else { string msg = ""; Log.LogInformation($"Configuration update failed:{msg}"); } } }