mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-25 04:46:04 +08:00
Apply suggestion from code review
This commit is contained in:
parent
9ff9834b36
commit
209d9bf62d
1 changed files with 7 additions and 10 deletions
|
|
@ -67,22 +67,19 @@ defmodule Livebook.FileSystem.Mounter do
|
|||
defp mount_file_systems(state, hub_id) do
|
||||
case Hubs.fetch_hub(hub_id) do
|
||||
{:ok, hub} ->
|
||||
file_systems = Hubs.get_file_systems(hub, hub_only: true)
|
||||
state = put_hub(state, hub.id)
|
||||
Enum.reduce(file_systems, state, &mount_file_system(&2, &1))
|
||||
hub
|
||||
|> Hubs.get_file_systems(hub_only: true)
|
||||
|> Enum.reduce(put_hub(state, hub.id), &mount_file_system(&2, &1))
|
||||
|
||||
:error ->
|
||||
state
|
||||
unmount_file_systems(state, hub_id)
|
||||
end
|
||||
end
|
||||
|
||||
defp remount_file_systems(state) do
|
||||
Enum.reduce(state.hubs, state, fn {hub_id, hub_data}, acc ->
|
||||
case Hubs.fetch_hub(hub_id) do
|
||||
{:ok, _} -> Enum.reduce(hub_data.file_systems, acc, &mount_file_system(&2, &1))
|
||||
:error -> unmount_file_systems(acc, hub_id)
|
||||
end
|
||||
end)
|
||||
state.hubs
|
||||
|> Map.keys()
|
||||
|> Enum.reduce(state, &mount_file_systems(&2, &1))
|
||||
end
|
||||
|
||||
defp unmount_file_systems(state, hub_id) do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue