Michael Schurter
967825d341
Fix comments: task -> check
2017-09-15 15:19:53 -07:00
Michael Schurter
3c0a42ba8e
Rename unhealthy var and fix test indeterminism
2017-09-14 16:48:39 -07:00
Michael Schurter
5cd1d57218
Watched -> TriggersRestart
...
Watched was a silly name
2017-09-14 16:48:39 -07:00
Michael Schurter
40ed2625f0
Handle multiple failing checks on a single task
...
Before this commit if a task had 2 checks cause restarts at the same
time, both would trigger restarts of the task! This change removes all
checks for a task whenever one of them is restarted.
2017-09-14 16:48:39 -07:00
Michael Schurter
f8e872c855
RestartDelay isn't needed as checks are re-added on restarts
...
@dadgar made the excellent observation in #3105 that TaskRunner removes
and re-registers checks on restarts. This means checkWatcher doesn't
need to do *any* internal restart tracking. Individual checks can just
remove themselves and be re-added when the task restarts.
2017-09-14 16:48:39 -07:00
Michael Schurter
237c096661
Simplify from 2 select loops to one
2017-09-14 16:48:39 -07:00
Michael Schurter
8b8c164622
Wrap check watch updates in a struct
...
Reusing checkRestart for both adds/removes and the main check restarting
logic was confusing.
2017-09-14 16:48:39 -07:00
Michael Schurter
3db835cb8f
Improve check watcher logging and add tests
...
Also expose a mock Consul Agent to allow testing ServiceClient and
checkWatcher from TaskRunner without actually talking to a real Consul.
2017-09-14 16:47:41 -07:00
Michael Schurter
c2d895d47a
Add comments and move delay calc to TaskRunner
2017-09-14 16:46:54 -07:00
Michael Schurter
555d1e24dc
on_warning=false -> ignore_warnings=false
...
Treat warnings as unhealthy by default
2017-09-14 16:46:54 -07:00
Michael Schurter
ebbf87f979
Use existing restart policy infrastructure
2017-09-14 16:46:54 -07:00
Michael Schurter
1608e59415
Add check watcher for restarting unhealthy tasks
2017-09-14 16:46:54 -07:00