Skip to content

Commit

Permalink
fix NPE on client disconnect to clear client session stats
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytro-landiak committed Oct 29, 2024
1 parent b80cd52 commit b4b3818
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.thingsboard.mqtt.broker.cluster.ServiceInfoProvider;
import org.thingsboard.mqtt.broker.common.data.BrokerConstants;
import org.thingsboard.mqtt.broker.common.data.kv.BasicTsKvEntry;
import org.thingsboard.mqtt.broker.common.data.kv.LongDataEntry;
import org.thingsboard.mqtt.broker.common.data.kv.TsKvEntry;
import org.thingsboard.mqtt.broker.common.data.BrokerConstants;
import org.thingsboard.mqtt.broker.common.util.DonAsynchron;
import org.thingsboard.mqtt.broker.dao.timeseries.TimeseriesService;
import org.thingsboard.mqtt.broker.gen.queue.QueueProtos;
Expand Down Expand Up @@ -202,7 +202,9 @@ public void reportClientReceiveStats(String clientId, int qos) {

@Override
public void removeClient(String clientId) {
clientSessionsStats.remove(clientId);
if (enabled) {
clientSessionsStats.remove(clientId);
}
}

private void reportClientStats(String clientId, String clientStatsKey, String clientQosStatsKey) {
Expand Down

0 comments on commit b4b3818

Please sign in to comment.