Make rabbit_mochiweb_registry:add/4 overwrite a record if you add the same context twice, rather than insert a duplicate.
This commit is contained in:
parent
c7a144db03
commit
84ba37b6c8
|
|
@ -50,7 +50,9 @@ handle_call({add, Context, Selector, Handler, Link}, _From,
|
|||
rabbit_mochiweb:context_listener(Context),
|
||||
rabbit_mochiweb_sup:ensure_listener(ListenerSpec),
|
||||
case lookup_dispatch(Listener) of
|
||||
{Selectors, Fallback} ->
|
||||
{OldSelectors, Fallback} ->
|
||||
Selectors = lists:filter(fun ({C, _, _, _}) -> C =/= Context end,
|
||||
OldSelectors),
|
||||
set_dispatch(Listener,
|
||||
{Selectors ++ [{Context, Selector, Handler, Link}],
|
||||
Fallback}),
|
||||
|
|
|
|||
Loading…
Reference in New Issue