diff options
| author | Ben Busby <noreply+git@benbusby.com> | 2021-10-22 18:07:59 -0600 |
|---|---|---|
| committer | Ben Busby <noreply+git@benbusby.com> | 2021-10-22 18:07:59 -0600 |
| commit | edcab37c7d48259c7cf7969f95cb4efdbd728c93 (patch) | |
| tree | f1870587138e1519387661ccec4465e02eed1a24 | |
| parent | 4949ae22bb2fd1b81cdfbbe21468015fb229b553 (diff) | |
| download | farside-edcab37c7d48259c7cf7969f95cb4efdbd728c93.tar.gz | |
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.
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | update.exs | 8 |
2 files changed, 11 insertions, 0 deletions
@@ -8,3 +8,6 @@ erl_crash.dump *.beam /config/*.secret.exs .elixir_ls/ + +# Ignore results from update script +.update-result* @@ -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") |
