From 7d037cfe910f8e85a905f119adcbc02d329f4da6 Mon Sep 17 00:00:00 2001 From: Andrew Mayorov Date: Wed, 10 Jan 2024 19:08:23 +0100 Subject: [PATCH] chore(route-sync): clarify why wait indefinitely for reply --- apps/emqx/src/emqx_router_syncer.erl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/emqx/src/emqx_router_syncer.erl b/apps/emqx/src/emqx_router_syncer.erl index d81fc5d88..c1928108a 100644 --- a/apps/emqx/src/emqx_router_syncer.erl +++ b/apps/emqx/src/emqx_router_syncer.erl @@ -89,7 +89,14 @@ push(Action, Topic, Dest, Opts) -> -spec wait(_WaitRef :: reference()) -> ok | {error, _Reason}. wait(MRef) -> - %% FIXME: timeouts + %% NOTE + %% No timeouts here because (as in `emqx_broker:call/2` case) callers do not + %% really expect this to fail with timeout exception. However, waiting + %% indefinitely is not the best option since it blocks the caller from receiving + %% other messages, so for instance channel (connection) process may not be able + %% to react to socket close event in time. Better option would probably be to + %% introduce cancellable operation, which will be able to check if the caller + %% would still be interested in the result. receive {MRef, Result} -> Result