mirror of
https://github.com/benbusby/farside.git
synced 2025-04-19 06:45:55 -04:00
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.
This commit is contained in:
parent
4949ae22bb
commit
edcab37c7d
3
.gitignore
vendored
3
.gitignore
vendored
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user