1
|
1
|
/**
|
2
|
2
|
* Copyright © 2016-2018 The Thingsboard Authors
|
3
|
|
- *
|
|
3
|
+ * <p>
|
4
|
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
5
|
* you may not use this file except in compliance with the License.
|
6
|
6
|
* You may obtain a copy of the License at
|
7
|
|
- *
|
8
|
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
9
|
|
- *
|
|
7
|
+ * <p>
|
|
8
|
+ * http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+ * <p>
|
10
|
10
|
* Unless required by applicable law or agreed to in writing, software
|
11
|
11
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
12
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
...
|
...
|
@@ -37,6 +37,7 @@ import org.thingsboard.server.common.data.kv.ReadTsKvQuery; |
37
|
37
|
import org.thingsboard.server.common.data.kv.TsKvEntry;
|
38
|
38
|
import org.thingsboard.server.dao.attributes.AttributesService;
|
39
|
39
|
import org.thingsboard.server.dao.timeseries.TimeseriesService;
|
|
40
|
+import org.thingsboard.server.dao.util.TenantRateLimitException;
|
40
|
41
|
import org.thingsboard.server.service.security.AccessValidator;
|
41
|
42
|
import org.thingsboard.server.service.security.ValidationCallback;
|
42
|
43
|
import org.thingsboard.server.service.security.ValidationResult;
|
...
|
...
|
@@ -403,7 +404,11 @@ public class DefaultTelemetryWebSocketService implements TelemetryWebSocketServi |
403
|
404
|
|
404
|
405
|
@Override
|
405
|
406
|
public void onFailure(Throwable e) {
|
406
|
|
- log.error(FAILED_TO_FETCH_DATA, e);
|
|
407
|
+ if (e instanceof TenantRateLimitException || e.getCause() instanceof TenantRateLimitException) {
|
|
408
|
+ log.trace("[{}] Tenant rate limit detected for subscription: [{}]:{}", sessionRef.getSecurityCtx().getTenantId(), entityId, cmd);
|
|
409
|
+ } else {
|
|
410
|
+ log.info(FAILED_TO_FETCH_DATA, e);
|
|
411
|
+ }
|
407
|
412
|
SubscriptionUpdate update = new SubscriptionUpdate(cmd.getCmdId(), SubscriptionErrorCode.INTERNAL_ERROR,
|
408
|
413
|
FAILED_TO_FETCH_DATA);
|
409
|
414
|
sendWsMsg(sessionRef, update);
|
...
|
...
|
|