-
Notifications
You must be signed in to change notification settings - Fork 18
Feature: Add dead LiveViews section #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
@spec update_dead_liveviews_setting!(boolean()) :: {:ok, boolean()} | {:error, term()} | ||
def update_dead_liveviews_setting!(new_value) when is_boolean(new_value) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels weird to have !
and ok error
tuple
end | ||
|
||
defp clear_tracing(socket) do | ||
def clear_tracing(socket) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: private and public functions should be grouped together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you handle DeadViewModeEntered
event like you do in node_traces_live.ex
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, I forgot
nil | ||
|
||
{:ok, socket} -> | ||
LvProcess.new(pid, socket) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LvProcess.new(pid, socket) | |
pid | |
|> LvProcess.new(socket) |
dead_lv_processes = | ||
StatesStorage.get_all_states() | ||
|> Enum.filter(fn {pid, %LvState{}} -> not Process.alive?(pid) end) | ||
|> Enum.map(&elem(&1, 1)) | ||
|> Enum.map(&(LvProcess.new(&1.pid, &1.socket) |> LvProcess.set_alive(false))) | ||
|
||
{:ok, %{dead_grouped_lv_processes: LiveViewDiscovery.group_lv_processes(dead_lv_processes)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dead_lv_processes = | |
StatesStorage.get_all_states() | |
|> Enum.filter(fn {pid, %LvState{}} -> not Process.alive?(pid) end) | |
|> Enum.map(&elem(&1, 1)) | |
|> Enum.map(&(LvProcess.new(&1.pid, &1.socket) |> LvProcess.set_alive(false))) | |
{:ok, %{dead_grouped_lv_processes: LiveViewDiscovery.group_lv_processes(dead_lv_processes)}} | |
dead_grouped_lv_processes = | |
StatesStorage.get_all_states() | |
|> Enum.filter(fn {pid, %LvState{}} -> not Process.alive?(pid) end) | |
|> Enum.map(&elem(&1, 1)) | |
|> Enum.map(&(LvProcess.new(&1.pid, &1.socket) |> LvProcess.set_alive(false))) | |
|> LiveViewDiscovery.group_lv_processes() | |
{:ok, %{dead_grouped_lv_processes: dead_grouped_lv_processes}} |
LiveViews listed below are not active anymore and they will be removed in a short time (usually within 2 seconds). | ||
If you want to keep them for a longer time you may do so by disabling | ||
<b>Garbage Collection</b> | ||
in <.link navigate={RoutesHelper.settings()} class="underline cursor-pointer">settings</.link>. But be aware that this will lead to increased memory usage. | ||
<% else %> | ||
You have <b>Garbage Collection</b> | ||
disabled which means that LiveViews listed below will not be removed automatically. | ||
This will lead to increased memory usage. You can enable it | ||
in <.link navigate={RoutesHelper.settings()} class="underline cursor-pointer">settings</.link>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd wrap these texts in <p>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whole if
expression is in <p>
tag. You want me to add one more inside each expression case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider splitting dead and active liveviews section do LiveComponents
No description provided.