mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-08 04:27:47 +08:00
Check if app deployment is still applicable before retrying failed deployment
This commit is contained in:
parent
57ef44278b
commit
eae053f1ad
1 changed files with 11 additions and 3 deletions
|
@ -315,13 +315,21 @@ defmodule Livebook.Apps.Manager do
|
||||||
end
|
end
|
||||||
|
|
||||||
defp retry(state, slug) do
|
defp retry(state, slug) do
|
||||||
if app_definitely_down?(slug) do
|
%{app_spec: app_spec} = state.deployments[slug]
|
||||||
%{app_spec: app_spec} = state.deployments[slug]
|
|
||||||
|
permanent_app_specs = Apps.get_permanent_app_specs()
|
||||||
|
|
||||||
|
# Check if the app spec has not been retracted or overridden with
|
||||||
|
# a new version
|
||||||
|
valid? = Enum.any?(permanent_app_specs, &(&1.slug == slug and &1.version == app_spec.version))
|
||||||
|
|
||||||
|
if valid? and app_definitely_down?(slug) do
|
||||||
ref = deploy(app_spec)
|
ref = deploy(app_spec)
|
||||||
put_in(state.deployments[slug].ref, ref)
|
put_in(state.deployments[slug].ref, ref)
|
||||||
else
|
else
|
||||||
{_, state} = pop_in(state.deployments[slug])
|
{_, state} = pop_in(state.deployments[slug])
|
||||||
state
|
# If there is a new version, we want to deploy it right away
|
||||||
|
sync_apps(state)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue