summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pg_local.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pg_local.erl b/src/pg_local.erl
index dc6401ca..4d9914d9 100644
--- a/src/pg_local.erl
+++ b/src/pg_local.erl
@@ -84,7 +84,13 @@ get_members(Name) ->
in_group(Name, Pid) ->
ensure_started(),
- member_present(Name, Pid).
+ %% The join message is a cast and thus can race, but we want to
+ %% keep it that way to be fast in the common case.
+ case member_present(Name, Pid) of
+ true -> true;
+ false -> sync(),
+ member_present(Name, Pid)
+ end.
sync() ->
ensure_started(),