mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-11-10 09:03:02 +08:00
Setup database upfront rather than lazily
This commit is contained in:
parent
dc8b771408
commit
b2eebcabbe
2 changed files with 15 additions and 10 deletions
|
@ -145,7 +145,7 @@ defmodule Livebook.Hubs.TeamClientTest do
|
|||
} = app_deployment}
|
||||
|
||||
# force app deployment to be deleted
|
||||
erpc_call(node, :stop_app_deployment, [app_deployment.id, team.org_id])
|
||||
erpc_call(node, :toggle_app_deployment, [app_deployment.id, team.org_id])
|
||||
|
||||
assert_receive {:app_deployment_stopped, ^app_deployment}
|
||||
end
|
||||
|
|
|
@ -13,7 +13,20 @@ defmodule Livebook.TeamsServer do
|
|||
|
||||
def setup do
|
||||
if available?() do
|
||||
mix(%__MODULE__{}, ["compile"])
|
||||
:ok =
|
||||
mix(%__MODULE__{}, [
|
||||
"do",
|
||||
"compile",
|
||||
"+",
|
||||
"ecto.drop",
|
||||
"--quiet",
|
||||
"+",
|
||||
"ecto.create",
|
||||
"--quiet",
|
||||
"+",
|
||||
"ecto.migrate",
|
||||
"--quiet"
|
||||
])
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -48,8 +61,6 @@ defmodule Livebook.TeamsServer do
|
|||
@impl true
|
||||
def handle_continue(:start_app, state) do
|
||||
ensure_app_dir!()
|
||||
prepare_database(state)
|
||||
|
||||
{:noreply, %{state | port: start_app(state)}}
|
||||
end
|
||||
|
||||
|
@ -182,12 +193,6 @@ defmodule Livebook.TeamsServer do
|
|||
"http://localhost:#{port}"
|
||||
end
|
||||
|
||||
defp prepare_database(state) do
|
||||
:ok = mix(state, ["ecto.drop", "--quiet"])
|
||||
:ok = mix(state, ["ecto.create", "--quiet"])
|
||||
:ok = mix(state, ["ecto.migrate", "--quiet"])
|
||||
end
|
||||
|
||||
defp ensure_app_dir! do
|
||||
dir = app_dir()
|
||||
|
||||
|
|
Loading…
Reference in a new issue