Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
8f744825
Commit
8f744825
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Implement exponential backoff (and recovery) for main timer.
parent
2ab40ae7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AutoTx/AutoTx.cs
+11
-5
11 additions, 5 deletions
AutoTx/AutoTx.cs
with
11 additions
and
5 deletions
AutoTx/AutoTx.cs
+
11
−
5
View file @
8f744825
...
...
@@ -421,13 +421,19 @@ namespace AutoTx
try
{
RunMainTasks
();
GC
.
Collect
();
// if everything went fine, reset the timer interval to its default value, so the
// service can even recover from temporary problems itself (see below):
_mainTimer
.
Interval
=
_config
.
ServiceTimer
;
}
catch
(
Exception
ex
)
{
// TODO / FIXME: combine log and admin-email!
var
msg
=
string
.
Format
(
"Error in OnTimedEvent(): {0}"
,
ex
.
Message
);
Log
.
Error
(
msg
);
SendAdminEmail
(
msg
);
Log
.
Debug
(
"Extended Error Info (StackTrace): {0}"
,
ex
.
StackTrace
);
// in case an Exception is reaching this level there is a good chance it is a
// permanent / recurring problem, therefore we increase the timer interval each
// time by a factor of ten (to avoid triggering the same issue every second and
// flooding the admins with emails):
_mainTimer
.
Interval
*=
10
;
Log
.
Error
(
"Unhandled exception in OnTimedEvent(): {0}\n\n"
+
"Trying exponential backoff, increasing timer interval to {1} ms.\n\n"
+
"StackTrace: {2}"
,
ex
.
Message
,
_mainTimer
.
Interval
,
ex
.
StackTrace
);
}
finally
{
// make sure to enable the timer again:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment