Skip to content

Commit 63a327c

Browse files
authored
fix (azure-iot-device): Prevent duplicate twin GET upon Connect (#1016)
* Stages (except the MQTTTransportStage) now always invoke `.send_event_up`() at the _end_ of the `.handle_pipeline_event()` call * Now that connection state has been improved by previous PRs, we no longer have to work around timing issues by invoking `.send_event_up()` early * By doing things in the correct order, we now will no longer be accidentally republishing the twin GET that triggers upon connection * Fixes #994
1 parent 7ca9ffe commit 63a327c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

azure-iot-device/azure/iot/device/common/pipeline/pipeline_stages_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,6 @@ def _handle_pipeline_event(self, event):
871871
undefined.
872872
"""
873873

874-
self.send_event_up(event)
875-
876874
for request_id in self.pending_responses:
877875
logger.info(
878876
"{stage}: ConnectedEvent: re-publishing request {id} for {method} {type} ".format(
@@ -884,6 +882,8 @@ def _handle_pipeline_event(self, event):
884882
)
885883
self._send_request_down(request_id, self.pending_responses[request_id])
886884

885+
self.send_event_up(event)
886+
887887
else:
888888
self.send_event_up(event)
889889

azure-iot-device/azure/iot/device/iothub/pipeline/pipeline_stages_iothub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _handle_pipeline_event(self, event):
114114
# before (or we've enabled them at least). If this is the case, get the twin to
115115
# see if the desired props have been updated.
116116
if self.last_version_seen:
117-
logger.info("{}: Reconnected. Getting twin")
117+
logger.info("{}: Reconnected. Getting twin".format(self.name))
118118
self._ensure_get_op()
119119
self.send_event_up(event)
120120

0 commit comments

Comments
 (0)