Skip to content

Commit

Permalink
fix: wait before startup to prevent race condition
Browse files Browse the repository at this point in the history
More informations: bitwalker/distillery#593
  • Loading branch information
hauleth committed Dec 2, 2018
1 parent 5ffdade commit cc7c85a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
3 changes: 1 addition & 2 deletions lib/imager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ defmodule Imager do

Instrumenter.Processing.command(commands)

Logger.metadata(input: file_name, commands: inspect(commands))
Logger.debug(inspect(args))
Logger.metadata(input: file_name)

with :error <- Store.retrieve(cache, result_name, opts),
{:ok, {_, _, in_stream}} <- Store.retrieve(store, file_name, opts) do
Expand Down
10 changes: 1 addition & 9 deletions lib/imager/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ defmodule Imager.Application do
{:ok, _} = Logger.add_backend(Sentry.LoggerBackend)
_ = Application.ensure_all_started(:sentry)

prometheus()
Imager.Instrumenter.setup()

JOSE.json_module(Imager.JOSE.Jason)

Expand All @@ -44,12 +44,4 @@ defmodule Imager.Application do

%{id: :exec_app, start: {:exec, :start_link, [opts]}}
end

defp prometheus do
:prometheus_registry.register_collector(:prometheus_process_collector)

Imager.Instrumenter.Cache.setup()
Imager.Instrumenter.Processing.setup()
Imager.Instrumenter.Storage.setup()
end
end
1 change: 1 addition & 0 deletions rel/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ environment :prod do
set commands: [
config: "rel/commands/config.sh"
]
set post_configure_hooks: "rel/hooks/post_configure"
set include_erts: true
set include_src: false
set cookie: :"1u[<S!I(rduF/Rzy8)&A<,$D{;y:&av9?V],2S/37FKidw5JKpq|j17^D2Gz]N=m"
Expand Down
4 changes: 4 additions & 0 deletions rel/hooks/post_configure/wait.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh

echo "Wait 1s to mitigate race condition in Distillery config"
sleep 1

0 comments on commit cc7c85a

Please sign in to comment.