Skip to content

Commit 8c02428

Browse files
Merge pull request #380 from leantk/users/leantk/retryUpdate
Delaying retry on send when ConnectionException is thrown
2 parents 0e6ef19 + 60e93a4 commit 8c02428

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/main/java/com/microsoft/applicationinsights/internal/channel/common/TransmissionNetworkOutput.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.io.IOException;
2626
import java.io.InputStream;
2727
import java.io.InputStreamReader;
28+
import java.net.ConnectException;
2829
import java.net.SocketException;
2930
import java.net.UnknownHostException;
3031
import java.text.DateFormat;
@@ -161,6 +162,10 @@ public boolean send(Transmission transmission) {
161162
InternalLogger.INSTANCE.error("Failed to send, connection pool timeout exception");
162163
} catch (SocketException e) {
163164
InternalLogger.INSTANCE.error("Failed to send, socket timeout exception");
165+
// backoff retry if no connection is found
166+
if (e instanceof ConnectException) {
167+
transmissionPolicyManager.suspendInSeconds(TransmissionPolicy.BLOCKED_BUT_CAN_BE_PERSISTED, DEFAULT_BACKOFF_TIME_SECONDS);
168+
}
164169
} catch (UnknownHostException e) {
165170
InternalLogger.INSTANCE.error("Failed to send, wrong host address or cannot reach address due to network issues, exception: %s", e.getMessage());
166171
} catch (IOException ioe) {

0 commit comments

Comments
 (0)