From 72def6d410f1f91210754403ee741de463e01960 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Wed, 23 Jul 2025 10:49:40 +1000 Subject: [PATCH] Apply exponential back-off to log shipping on non-Exception failures, too --- src/SeqCli/Ingestion/LogShipper.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/SeqCli/Ingestion/LogShipper.cs b/src/SeqCli/Ingestion/LogShipper.cs index fbd892b..337e500 100644 --- a/src/SeqCli/Ingestion/LogShipper.cs +++ b/src/SeqCli/Ingestion/LogShipper.cs @@ -85,12 +85,13 @@ public static async Task ShipBufferAsync( } catch (Exception ex) { - var millisecondsDelay = (int)Math.Min(Math.Pow(2, retries) * 2000, 60000); - sendFailureLog.Error(ex, "Failed to send an event batch; retry in {MillisecondsDelay}", millisecondsDelay); - - await Task.Delay(millisecondsDelay, cancellationToken); - retries += 1; + sendFailureLog.Error(ex, "Failed to ship a batch"); } + + var millisecondsDelay = (int)Math.Min(Math.Pow(2, retries) * 2000, 60000); + sendFailureLog.Information("Backing off connection schedule; will retry in {MillisecondsDelay}", millisecondsDelay); + await Task.Delay(millisecondsDelay, cancellationToken); + retries += 1; } }