public static async Task <string> GetDeployHistory(string branch) { var deployHistory = Task.Run(() => { HistoryCache cache = null; if (BranchCache.ContainsKey(branch)) { cache = BranchCache[branch]; } else { cache = new HistoryCache(branch); } lock (cache) { TimeSpan timeDiff = DateTime.Now - cache.LastUpdate; if (timeDiff.TotalMinutes > 5) { string historyEndpoint = $"https://s3.amazonaws.com/setup.{branch}.com/DeployHistory.txt"; using (WebClient http = new WebClient()) cache.History = http.DownloadString(historyEndpoint); cache.LastUpdate = DateTime.Now; } return(cache.History); } }); return(await deployHistory.ConfigureAwait(false)); }
public static async Task <StudioDeployLogs> Get(string branch) { StudioDeployLogs logs = null; if (LogCache.ContainsKey(branch)) { logs = LogCache[branch]; } else { logs = new StudioDeployLogs(branch); } var getDeployHistory = HistoryCache.GetDeployHistory(branch); string deployHistory = await getDeployHistory.ConfigureAwait(false); if (logs.LastDeployHistory != deployHistory) { int maxVersion = int.MaxValue; if (branch == "roblox") { string binaryType = StudioBootstrapper.GetStudioBinaryType(); var getInfo = ClientVersionInfo.Get(binaryType); var info = await getInfo.ConfigureAwait(false); int version = info.Version .Split('.') .Select(int.Parse) .Skip(1) .First(); maxVersion = version; } logs.LastDeployHistory = deployHistory; logs.UpdateLogs(deployHistory, maxVersion); } return(logs); }
public static async Task <StudioDeployLogs> Get(string branch) { StudioDeployLogs logs = null; if (LogCache.ContainsKey(branch)) { logs = LogCache[branch]; } else { logs = new StudioDeployLogs(branch); } string deployHistory = await HistoryCache.GetDeployHistory(branch); if (logs.LastDeployHistory != deployHistory) { logs.LastDeployHistory = deployHistory; logs.UpdateLogs(deployHistory); } return(logs); }