private static void RunEx(ClientConfiguration.ReporterOptions config) { // give ssh some time to catch up Thread.Sleep((config.IntervalInSeconds * 1000)); if (!config.IsEnabled) { return; } while (true) { try { // build payload if (BondManager.CurrentPorts.Count > 0) { var payload = MachineSurveyBuilder.Build(); DoPost(config, payload); } } catch (Exception e) { _log.Error(e); } Thread.Sleep((config.IntervalInSeconds * 1000)); } }
internal static void Run(ClientConfiguration.ReporterOptions config) { new Thread(() => { Thread.CurrentThread.IsBackground = true; RunEx(config); }).Start(); }
private static void DoPost(ClientConfiguration.ReporterOptions config, ExerciseAgent exerciseAgent) { //call home var client = new RestClient(config.PostUrl); var request = new RestRequest(Method.POST) { RequestFormat = DataFormat.Json }; request.AddJsonBody(exerciseAgent); var response = client.Execute(request); _log.Info($"Post response {response.StatusCode}: {response.Content}"); // is there a need for a return here? // return JsonConvert.DeserializeObject<Catalog>(dataString); }