From 4d3c0b57851af3b122ac70fa6c7be64d61709150 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Wed, 31 Jan 2018 00:24:02 +0100 Subject: [PATCH] Limit the exponential backoff for the timer to half a day. --- AutoTx/AutoTx.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index c4581c1..7afadb4 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -438,8 +438,12 @@ namespace AutoTx // time by a factor of ten (to avoid triggering the same issue every second and // flooding the admins with emails): _mainTimer.Interval *= 10; + // make sure the interval doesn't exceed half a day: + const int maxInterval = 1000 * 60 * 60 * 12; + if (_mainTimer.Interval > maxInterval) + _mainTimer.Interval = maxInterval; Log.Error("Unhandled exception in OnTimedEvent(): {0}\n\n" + - "Trying exponential backoff, increasing timer interval to {1} ms.\n\n" + + "Trying exponential backoff, setting timer interval to {1} ms.\n\n" + "StackTrace: {2}", ex.Message, _mainTimer.Interval, ex.StackTrace); } finally { @@ -879,3 +883,4 @@ namespace AutoTx } } + -- GitLab