mirror of
https://github.com/safing/portbase
synced 2025-09-02 10:40:39 +00:00
Merge pull request #51 from safing/fix/increase-module-timeouts
Increase module start/stop timeouts
This commit is contained in:
commit
3fc438df10
1 changed files with 6 additions and 3 deletions
|
@ -19,6 +19,9 @@ var (
|
||||||
// lock modules when starting
|
// lock modules when starting
|
||||||
modulesLocked = abool.New()
|
modulesLocked = abool.New()
|
||||||
|
|
||||||
|
moduleStartTimeout = 2 * time.Minute
|
||||||
|
moduleStopTimeout = 1 * time.Minute
|
||||||
|
|
||||||
// ErrCleanExit is returned by Start() when the program is interrupted before starting. This can happen for example, when using the "--help" flag.
|
// ErrCleanExit is returned by Start() when the program is interrupted before starting. This can happen for example, when using the "--help" flag.
|
||||||
ErrCleanExit = errors.New("clean exit requested")
|
ErrCleanExit = errors.New("clean exit requested")
|
||||||
)
|
)
|
||||||
|
@ -117,7 +120,7 @@ func (m *Module) prep(reports chan *report) {
|
||||||
// execute function
|
// execute function
|
||||||
err = m.runCtrlFnWithTimeout(
|
err = m.runCtrlFnWithTimeout(
|
||||||
"prep module",
|
"prep module",
|
||||||
10*time.Second,
|
moduleStartTimeout,
|
||||||
m.prepFn,
|
m.prepFn,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -173,7 +176,7 @@ func (m *Module) start(reports chan *report) {
|
||||||
// execute function
|
// execute function
|
||||||
err = m.runCtrlFnWithTimeout(
|
err = m.runCtrlFnWithTimeout(
|
||||||
"start module",
|
"start module",
|
||||||
10*time.Second,
|
moduleStartTimeout,
|
||||||
m.startFn,
|
m.startFn,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -248,7 +251,7 @@ func (m *Module) stopAllTasks(reports chan *report) {
|
||||||
// wait for results
|
// wait for results
|
||||||
select {
|
select {
|
||||||
case <-done:
|
case <-done:
|
||||||
case <-time.After(30 * time.Second):
|
case <-time.After(moduleStopTimeout):
|
||||||
log.Warningf(
|
log.Warningf(
|
||||||
"%s: timed out while waiting for stopfn/workers/tasks to finish: stopFn=%v workers=%d tasks=%d microtasks=%d, continuing shutdown...",
|
"%s: timed out while waiting for stopfn/workers/tasks to finish: stopFn=%v workers=%d tasks=%d microtasks=%d, continuing shutdown...",
|
||||||
m.Name,
|
m.Name,
|
||||||
|
|
Loading…
Add table
Reference in a new issue