Skip to content

Commit

Permalink
Allow code_reload.node to be a list of nodes (#1413)
Browse files Browse the repository at this point in the history
It can now be either
```
code_reload:
  node: node@localhost
```

or
```
code_reload:
  node:
    - node-1@localhost
    - node-2@localhost
```
  • Loading branch information
mkuratczyk authored Jan 8, 2024
1 parent 31dd2dd commit 22ae2c0
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions apps/els_lsp/src/els_code_reload.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,30 @@ maybe_compile_and_load(Uri) ->
Ext = filename:extension(Uri),
case els_config:get(code_reload) of
#{"node" := NodeStr} when Ext == <<".erl">> ->
Node = els_utils:compose_node_name(
NodeStr,
els_config_runtime:get_name_type()
),
Nodes =
case NodeStr of
[List | _] when is_list(List) ->
NodeStr;
List when is_list(List) ->
[NodeStr];
_ ->
not_a_list
end,
Module = els_uri:module(Uri),
case rpc:call(Node, code, is_sticky, [Module]) of
true -> ok;
_ -> handle_rpc_result(rpc:call(Node, c, c, [Module]), Module)
end;
[
begin
Node = els_utils:compose_node_name(
N,
els_config_runtime:get_name_type()
),
case rpc:call(Node, code, is_sticky, [Module]) of
true -> ok;
_ -> handle_rpc_result(rpc:call(Node, c, c, [Module]), Module)
end
end
|| N <- Nodes
],
ok;
_ ->
ok
end.
Expand Down

0 comments on commit 22ae2c0

Please sign in to comment.