Skip to content
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

container instance checks #75

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Next Next commit
Fix case when opening DBs are not seen
zadean committed Nov 5, 2022
commit 1ac25c34111cbcc807c2a70648d5cffd52e41567
6 changes: 4 additions & 2 deletions src/xqldb_db_server.erl
Original file line number Diff line number Diff line change
@@ -140,6 +140,7 @@ do_get_open(Path, Ets) ->
MPattern = Path ++ '$1',
MatchSpec = [
{{{MPattern, '_', '_'}, '_', open}, [], ['$1']},
{{{MPattern, '_', '_'}, '_', opening}, [], ['$1']},
{{{MPattern, '_', '_'}, '_', closed}, [], ['$1']}
],
Res = ets:select(Ets, MatchSpec),
@@ -283,13 +284,14 @@ handle_call({info, Path, _Uri}, _From, #{tab := Ets} = State) ->
{reply, {error, not_exists}, State};
[{{_, _, _}, _, missing}] ->
{reply, {error, not_exists}, State};
[{{_, _, Id}, Pid, Status}] when is_pid(Pid) ->
[{{_, Uri, Id}, Pid, Status}] when is_pid(Pid) ->
% check if it is still alive
case erlang:is_process_alive(Pid) of
true ->
{reply, {Status, Id, Pid}, State};
false ->
{reply, {error, not_exists}, State}
ets:insert(Ets, {{Path, Uri, Id}, undefined, closed}),
{reply, {closed, Id, undefined}, State}
end;
[{{_, _, Id}, undefined, opening}] ->
{reply, {opening, Id, undefined}, State};