Skip to content

Commit 83c42ed

Browse files
committed
Added rate limits processing for attributes datapoints
1 parent 275e4d8 commit 83c42ed

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
with open(path.join(this_directory, 'README.md')) as f:
2222
long_description = f.read()
2323

24-
VERSION = "1.13.5"
24+
VERSION = "1.13.6"
2525

2626
setup(
2727
version=VERSION,

tb_device_mqtt.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,13 +1050,14 @@ def _wait_until_current_queued_messages_processed(self):
10501050

10511051
def _send_request(self, _type, kwargs, timeout=DEFAULT_TIMEOUT, device=None,
10521052
msg_rate_limit=None, dp_rate_limit=None):
1053+
topic = kwargs['topic']
10531054
if msg_rate_limit is None:
1054-
if kwargs.get('topic') == TELEMETRY_TOPIC:
1055+
if topic == TELEMETRY_TOPIC or topic ==ATTRIBUTES_TOPIC:
10551056
msg_rate_limit = self._telemetry_rate_limit
10561057
else:
10571058
msg_rate_limit = self._messages_rate_limit
10581059
if dp_rate_limit is None:
1059-
if kwargs.get('topic') == TELEMETRY_TOPIC:
1060+
if topic == TELEMETRY_TOPIC or topic ==ATTRIBUTES_TOPIC:
10601061
dp_rate_limit = self._telemetry_dp_rate_limit
10611062
else:
10621063
dp_rate_limit = self.EMPTY_RATE_LIMIT
@@ -1101,7 +1102,7 @@ def __send_publish_with_limitations(self, kwargs, timeout, device=None, msg_rate
11011102
data = kwargs.get("payload")
11021103
if isinstance(data, str):
11031104
data = loads(data)
1104-
topic = kwargs.get("topic", '')
1105+
topic = kwargs["topic"]
11051106
attributes_format = topic.endswith('attributes')
11061107
if topic.endswith('telemetry') or attributes_format:
11071108
if device is None or data.get(device) is None:

tb_gateway_mqtt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,10 @@ def __request_attributes(self, device, keys, callback, type_is_client=False):
191191

192192
def _send_device_request(self, _type, device_name, **kwargs):
193193
if _type == TBSendMethod.PUBLISH:
194+
topic = kwargs['topic']
194195
device_msg_rate_limit = self._devices_connected_through_gateway_messages_rate_limit
195196
device_dp_rate_limit = self.EMPTY_RATE_LIMIT
196-
if kwargs.get('topic') == GATEWAY_TELEMETRY_TOPIC:
197+
if topic == GATEWAY_TELEMETRY_TOPIC or topic == GATEWAY_ATTRIBUTES_TOPIC:
197198
device_msg_rate_limit = self._devices_connected_through_gateway_telemetry_messages_rate_limit
198199
device_dp_rate_limit = self._devices_connected_through_gateway_telemetry_datapoints_rate_limit
199200
info = self._publish_data(**kwargs, device=device_name,

0 commit comments

Comments
 (0)