Преглед изворни кода

chore(route-sync): clarify why wait indefinitely for reply

Andrew Mayorov пре 2 година
родитељ
комит
7d037cfe91
1 измењених фајлова са 8 додато и 1 уклоњено
  1. 8 1
      apps/emqx/src/emqx_router_syncer.erl

+ 8 - 1
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