Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(iot-device): Update IoT Hub CONNACK timeout to be 60 seconds #2042

Merged
merged 2 commits into from
Jun 18, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions iothub/device/src/Transport/Mqtt/MqttTransportSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ public class MqttTransportSettings : ITransportSettings
private const int DefaultMaxPendingInboundMessages = 50;
private const QualityOfService DefaultPublishToServerQoS = QualityOfService.AtLeastOnce;
private const QualityOfService DefaultReceivingQoS = QualityOfService.AtLeastOnce;
private static readonly TimeSpan s_defaultConnectArrivalTimeout = TimeSpan.FromSeconds(10);

// The CONNACK timeout has been chosen to be 60 seconds to be in alignment with the service implemented timeout for processing connection requests.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for adding a code comment

private static readonly TimeSpan s_defaultConnectArrivalTimeout = TimeSpan.FromSeconds(60);

private static readonly TimeSpan s_defaultDeviceReceiveAckTimeout = TimeSpan.FromSeconds(300);
private static readonly TimeSpan s_defaultReceiveTimeout = TimeSpan.FromMinutes(1);

Expand Down Expand Up @@ -157,8 +160,15 @@ public bool CertificateRevocationCheck

/// <summary>
/// The time to wait for receiving an acknowledgment for a CONNECT packet.
/// The default is 10 seconds.
/// The default is 60 seconds.
/// </summary>
/// <remarks>
/// In the event that IoT Hub receives burst traffic, it will implement traffic shaping in order to process the incoming requests.
/// In such cases, during client connection the CONNECT requests can have a delay in being acknowledged and processed by IoT Hub.
/// The <see cref="ConnectArrivalTimeout"/> governs the duration the client will wait for a CONNACK packet before disconnecting and reopening the connection.
/// To know more about IoT Hub's throttling limits and traffic shaping feature, see
/// <see href="https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-quotas-throttling#operation-throttles"/>.
/// </remarks>
public TimeSpan ConnectArrivalTimeout { get; set; }

/// <summary>
Expand Down Expand Up @@ -239,4 +249,4 @@ public TransportType GetTransportType()
/// </summary>
internal string AuthenticationChain { get; set; }
}
}
}