fix format

This commit is contained in:
anlicheng 2026-04-19 17:31:19 +08:00
parent 980f6ff4d5
commit b3d795c523

View File

@ -90,6 +90,7 @@ init([]) ->
%% SubscriberPid只能订阅同一个topic一次
handle_call(get_subscribers, _From, State = #state{subscribers = Subscribers}) ->
{reply, {ok, Subscribers}, State};
handle_call({subscribe, Topic, SubscriberPid}, _From, State = #state{subscribers = Subscribers}) ->
Components = of_components(Topic),
case is_valid_components(Components) of
@ -112,6 +113,7 @@ handle_call({subscribe, Topic, SubscriberPid}, _From, State = #state{subscribers
false ->
{reply, {error, <<"invalid topic name">>}, State}
end;
handle_call({unsubscribe, Topic, SubscriberPid}, _From, State = #state{subscribers = Subscribers}) ->
{Removed, Reserved} = lists:partition(fun(#subscriber{topic = Topic0, subscriber_pid = SubscriberPid0}) ->
Topic =:= Topic0 andalso SubscriberPid =:= SubscriberPid0