Commit 6d006d16c7522d8c59e1f51f4627c7f47f98430d
1 parent
055331a8
Improved rate limits message for MQTT session events
Showing
3 changed files
with
3 additions
and
2 deletions
... | ... | @@ -26,6 +26,7 @@ public class TbRateLimitsException extends RuntimeException { |
26 | 26 | private final EntityType entityType; |
27 | 27 | |
28 | 28 | public TbRateLimitsException(EntityType entityType) { |
29 | + super(entityType.name() + " rate limits reached!"); | |
29 | 30 | this.entityType = entityType; |
30 | 31 | } |
31 | 32 | } | ... | ... |
... | ... | @@ -951,7 +951,7 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement |
951 | 951 | @Override |
952 | 952 | public void onError(Throwable e) { |
953 | 953 | if (e instanceof TbRateLimitsException) { |
954 | - log.trace("[{}] Failed to submit session event", sessionId, e); | |
954 | + log.trace("[{}] Failed to submit session event: {}", sessionId, e.getMessage()); | |
955 | 955 | } else { |
956 | 956 | log.warn("[{}] Failed to submit session event", sessionId, e); |
957 | 957 | } | ... | ... |
... | ... | @@ -57,7 +57,7 @@ public class DefaultTransportRateLimitService implements TransportRateLimitServi |
57 | 57 | @Override |
58 | 58 | public EntityType checkLimits(TenantId tenantId, DeviceId deviceId, int dataPoints) { |
59 | 59 | if (!tenantAllowed.getOrDefault(tenantId, Boolean.TRUE)) { |
60 | - return EntityType.TENANT; | |
60 | + return EntityType.API_USAGE_STATE; | |
61 | 61 | } |
62 | 62 | if (!checkEntityRateLimit(dataPoints, getTenantRateLimits(tenantId))) { |
63 | 63 | return EntityType.TENANT; | ... | ... |