summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-08-20 11:53:23 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-08-20 11:53:23 +0100
commite5fc9f333c0a496f08efda2730c36d9482992c30 (patch)
treec8da832ac81a897b0a4caa3732c87e17f0305764 /src
parent7d26dce13c03f93e97413573ae37f7474aa05f6c (diff)
downloadrabbitmq-server-git-e5fc9f333c0a496f08efda2730c36d9482992c30.tar.gz
Fix a race.
Diffstat (limited to 'src')
-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 dc6401caa0..4d9914d9b7 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(),