Skip to content

Commit e464e08

Browse files
michaelklishinmergify[bot]
authored andcommitted
Web MQTT: release FHC handle only if FHC is enabled
(cherry picked from commit 3339e8d)
1 parent ab4dfcf commit e464e08

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
@@ -238,11 +238,18 @@ terminate(Reason, Request, #state{} = State) ->
238238
terminate(_Reason, _Request,
239239
{SendWill, #state{conn_name = ConnName,
240240
proc_state = PState,
241-
keepalive = KState} = State}) ->
241+
keepalive = KState,
242+
should_use_fhc = ShouldUseFHC} = State}) ->
242243
?LOG_INFO("Web MQTT closing connection ~ts", [ConnName]),
243244
maybe_emit_stats(State),
244245
_ = rabbit_mqtt_keepalive:cancel_timer(KState),
245-
ok = file_handle_cache:release(),
246+
case ShouldUseFHC of
247+
true ->
248+
ok = file_handle_cache:release();
249+
false -> ok;
250+
undefined ->
251+
ok = file_handle_cache:release()
252+
end,
246253
case PState of
247254
connect_packet_unprocessed ->
248255
ok;

0 commit comments

Comments
 (0)