Skip to content

Commit 3339e8d

Browse files
Web MQTT: release FHC handle only if FHC is enabled
1 parent 1402183 commit 3339e8d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

deps/rabbitmq_web_mqtt/src/rabbit_web_mqtt_handler.erl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,18 @@ terminate(Reason, Request, #state{} = State) ->
253253
terminate(_Reason, _Request,
254254
{SendWill, #state{conn_name = ConnName,
255255
proc_state = PState,
256-
keepalive = KState} = State}) ->
256+
keepalive = KState,
257+
should_use_fhc = ShouldUseFHC} = State}) ->
257258
?LOG_INFO("Web MQTT closing connection ~ts", [ConnName]),
258259
maybe_emit_stats(State),
259260
_ = rabbit_mqtt_keepalive:cancel_timer(KState),
260-
ok = file_handle_cache:release(),
261+
case ShouldUseFHC of
262+
true ->
263+
ok = file_handle_cache:release();
264+
false -> ok;
265+
undefined ->
266+
ok = file_handle_cache:release()
267+
end,
261268
case PState of
262269
connect_packet_unprocessed ->
263270
ok;

0 commit comments

Comments
 (0)