summaryrefslogtreecommitdiff
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
commite039c90768ea78e9deed108b72702dba49ef0302 (patch)
treec8da832ac81a897b0a4caa3732c87e17f0305764
parent7983305bf14d846774c37ca67dcf6ac1c88474b9 (diff)
downloadrabbitmq-server-bug25813.tar.gz
Fix a race.bug25813
-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(),