Skip to content

Commit

Permalink
Fix EUnit test regression problem
Browse files Browse the repository at this point in the history
In the gproc_dist_test, the receiving node of a counter update
would erroneously recalculate the aggregated counter, even though
the aggregated counter was replicated as well.
  • Loading branch information
uwiger committed Mar 4, 2013
1 parent 4f3bbd7 commit 81ff4ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
11 changes: 2 additions & 9 deletions src/gproc_dist.erl
Expand Up @@ -615,17 +615,10 @@ from_leader(Ops, S, _E) ->
insert_globals(Globals) -> insert_globals(Globals) ->
ets:insert(?TAB, Globals), ets:insert(?TAB, Globals),
lists:foldl( lists:foldl(
fun({{{T,_,_} = Key,Pid}, Pid, _}, A) -> fun({{{_,_,_} = Key,Pid}, Pid, _}, A) ->
A1 = case T of
c ->
Incr = ets:lookup_element(?TAB, {Key,Pid}, 3),
update_aggr_counter(Key, -Incr) ++ A;
_ ->
A
end,
ets:insert_new(?TAB, {{Pid,Key}, []}), ets:insert_new(?TAB, {{Pid,Key}, []}),
gproc_lib:ensure_monitor(Pid,g), gproc_lib:ensure_monitor(Pid,g),
A1; A;
({{{_,_,_}, n}, Pid, _}, A) -> ({{{_,_,_}, n}, Pid, _}, A) ->
gproc_lib:ensure_monitor(Pid,g), gproc_lib:ensure_monitor(Pid,g),
A; A;
Expand Down
2 changes: 1 addition & 1 deletion test/gproc_dist_tests.erl
Expand Up @@ -301,7 +301,7 @@ got_msg(Pb, Tag) ->
receive receive
M when element(1, M) == Tag -> M when element(1, M) == Tag ->
M M
after 1000 -> after 5000 ->
timeout timeout
end end
end}). end}).
Expand Down

0 comments on commit 81ff4ce

Please sign in to comment.