From edcab37c7d48259c7cf7969f95cb4efdbd728c93 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Fri, 22 Oct 2021 18:07:59 -0600 Subject: Write results of update script to file for debugging The update script now writes the available instances to a .update-results* file (where previous runs have "-prev" appended to the file name). This helps to see how instance availability changes between runs of the script when debugging overall functionality of the app. --- update.exs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'update.exs') diff --git a/update.exs b/update.exs index dad22ec..65110f6 100644 --- a/update.exs +++ b/update.exs @@ -33,6 +33,7 @@ defmodule Instances do end) add_to_redis(conn, service, result) + log_results(service.type, result) end end @@ -65,6 +66,13 @@ defmodule Instances do ]) end end + + def log_results(service_name, results) do + {:ok, file} = File.open(".update-results", [:append, {:delayed_write, 100, 20}]) + IO.write(file, service_name <> ": " <> inspect(results) <> "\n") + File.close(file) + end end +File.rename(".update-results", ".update-results-prev") Instances.update("services.json") -- cgit v1.2.3