Skip to content

fix(twin): survive transient iothub disconnects and fix desired property path#43

Merged
JanZachmann merged 1 commit intoomnect:mainfrom
JanZachmann:async_azure_sdk
Mar 11, 2026
Merged

fix(twin): survive transient iothub disconnects and fix desired property path#43
JanZachmann merged 1 commit intoomnect:mainfrom
JanZachmann:async_azure_sdk

Conversation

@JanZachmann
Copy link
Contributor

  • Replace anyhow::ensure! with exhaustive UnauthenticatedReason match so transient errors (NoNetwork, ExpiredSasToken, etc.) are logged and survived instead of crashing the module.
  • Fix desired property path: Complete updates nest location under desired["desired"]["location"]; Partial updates expose it at the top level.
  • Adopt lazy client init pattern with tokio::pin! retry loop matching the omnect-device-service reference implementation.
  • Add TwinState enum (Uninitialized/Initialized/Authenticated) replacing the authenticated_once bool.
  • Add reset_client_with_delay() for BadCredential/CommunicationError recovery.
  • Add biased select! and client-presence guards on reported/outgoing branches.

…rty path

- Replace anyhow::ensure! with exhaustive UnauthenticatedReason match so
  transient errors (NoNetwork, ExpiredSasToken, etc.) are logged and
  survived instead of crashing the module.
- Fix desired property path: Complete updates nest location under
  desired["desired"]["location"]; Partial updates expose it at the
  top level.
- Adopt lazy client init pattern with tokio::pin! retry loop matching
  the omnect-device-service reference implementation.
- Add TwinState enum (Uninitialized/Initialized/Authenticated) replacing
  the authenticated_once bool.
- Add reset_client_with_delay() for BadCredential/CommunicationError
  recovery.
- Add biased select! and client-presence guards on reported/outgoing
  branches.

Signed-off-by: Jan Zachmann <50990105+JanZachmann@users.noreply.github.com>
@JanZachmann JanZachmann merged commit 7a2b252 into omnect:main Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant