Skip to content

Commit

Permalink
Ensure to use default pool for publishes to (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
mworrell authored Nov 15, 2023
1 parent 0d5b3e0 commit 186b3f1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/mqtt_sessions_router.erl
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ publish( Pool, Topic, Msg ) ->
-spec publish( atom(), list(), mqtt_packet_map:mqtt_packet(), term() ) -> {ok, pid() | undefined} | {error, overload}.
publish( Pool, Topic0, Msg, PublisherContext ) ->
Topic = publish_topic(Topic0),
Routes = router:route(Pool, Topic),
case mqtt_sessions_job:publish(Pool, Topic, Routes, Msg, PublisherContext) of
Pool1 = maybe_map_to_default_pool(Pool, Topic),
Routes = router:route(Pool1, Topic),
case mqtt_sessions_job:publish(Pool1, Topic, Routes, Msg, PublisherContext) of
{ok, JobPid} ->
case maps:get(retain, Msg, false) of
true -> mqtt_sessions_retain:retain(Pool, Msg, PublisherContext);
true -> mqtt_sessions_retain:retain(Pool1, Msg, PublisherContext);
false -> ok
end,
{ok, JobPid};
Expand Down

0 comments on commit 186b3f1

Please sign in to comment.