Skip to content

Commit 3c2de2d

Browse files
committed
Check if app deployment is still applicable before retrying failed deployment
1 parent 2a6c52b commit 3c2de2d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/livebook/apps/manager.ex

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,13 +315,21 @@ defmodule Livebook.Apps.Manager do
315315
end
316316

317317
defp retry(state, slug) do
318-
if app_definitely_down?(slug) do
319-
%{app_spec: app_spec} = state.deployments[slug]
318+
%{app_spec: app_spec} = state.deployments[slug]
319+
320+
permanent_app_specs = Apps.get_permanent_app_specs()
321+
322+
# Check if the app spec has not been retracted or overridden with
323+
# a new version
324+
valid? = Enum.any?(permanent_app_specs, &(&1.slug == slug and &1.version == app_spec.version))
325+
326+
if valid? and app_definitely_down?(slug) do
320327
ref = deploy(app_spec)
321328
put_in(state.deployments[slug].ref, ref)
322329
else
323330
{_, state} = pop_in(state.deployments[slug])
324-
state
331+
# If there is a new version, we want to deploy it right away
332+
sync_apps(state)
325333
end
326334
end
327335

0 commit comments

Comments
 (0)