internal/app: do not offset base value
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m12s
Test / Hpkg (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 4m23s
Test / Hakurei (race detector) (push) Successful in 5m16s
Test / Hakurei (push) Successful in 2m9s
Test / Flake checks (push) Successful in 1m25s
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m12s
Test / Hpkg (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 4m23s
Test / Hakurei (race detector) (push) Successful in 5m16s
Test / Hakurei (push) Successful in 2m9s
Test / Flake checks (push) Successful in 1m25s
This value is applied to the shim, it is incorrect to offset the base value as well. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
92b83bd599
commit
80ad2e4e23
@ -11,6 +11,13 @@ const Tmp = "/.hakurei"
|
||||
|
||||
var AbsTmp = container.MustAbs(Tmp)
|
||||
|
||||
const (
|
||||
// DefaultWaitDelay is used when WaitDelay has its zero value.
|
||||
DefaultWaitDelay = 5 * time.Second
|
||||
// MaxWaitDelay is used if WaitDelay exceeds its value.
|
||||
MaxWaitDelay = 30 * time.Second
|
||||
)
|
||||
|
||||
// Config is used to seal an app implementation.
|
||||
type (
|
||||
Config struct {
|
||||
|
@ -186,13 +186,12 @@ func (k *outcome) finalise(ctx context.Context, msg container.Msg, id *state.ID,
|
||||
}
|
||||
|
||||
// enforce bounds and default early
|
||||
kp.waitDelay = shimWaitTimeout
|
||||
if s.Container.WaitDelay <= 0 {
|
||||
kp.waitDelay += DefaultShimWaitDelay
|
||||
} else if s.Container.WaitDelay > MaxShimWaitDelay {
|
||||
kp.waitDelay += MaxShimWaitDelay
|
||||
kp.waitDelay = hst.DefaultWaitDelay
|
||||
} else if s.Container.WaitDelay > hst.MaxWaitDelay {
|
||||
kp.waitDelay = hst.MaxWaitDelay
|
||||
} else {
|
||||
kp.waitDelay += s.Container.WaitDelay
|
||||
kp.waitDelay = s.Container.WaitDelay
|
||||
}
|
||||
|
||||
if s.Container.MapRealUID {
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
"hakurei.app/system"
|
||||
)
|
||||
|
||||
// duration to wait for shim to exit, after container WaitDelay has elapsed.
|
||||
// Duration to wait for shim to exit on top of container WaitDelay.
|
||||
const shimWaitTimeout = 5 * time.Second
|
||||
|
||||
// mainState holds persistent state bound to outcome.main.
|
||||
@ -81,7 +81,7 @@ func (ms mainState) beforeExit(isFault bool) {
|
||||
waitDone := make(chan struct{})
|
||||
|
||||
// this ties waitDone to ctx with the additional compensated timeout duration
|
||||
go func() { <-ms.k.ctx.Done(); time.Sleep(ms.waitDelay); close(waitDone) }()
|
||||
go func() { <-ms.k.ctx.Done(); time.Sleep(ms.waitDelay + shimWaitTimeout); close(waitDone) }()
|
||||
|
||||
select {
|
||||
case err := <-ms.cmdWait:
|
||||
|
@ -42,11 +42,6 @@ const (
|
||||
ShimExitRequest = 254
|
||||
// ShimExitOrphan is returned when the shim is orphaned before monitor delivers a signal.
|
||||
ShimExitOrphan = 3
|
||||
|
||||
// DefaultShimWaitDelay is used when WaitDelay has its zero value.
|
||||
DefaultShimWaitDelay = 5 * time.Second
|
||||
// MaxShimWaitDelay is used instead if WaitDelay exceeds its value.
|
||||
MaxShimWaitDelay = 30 * time.Second
|
||||
)
|
||||
|
||||
// ShimMain is the main function of the shim process and runs as the unconstrained target user.
|
||||
|
Loading…
x
Reference in New Issue
Block a user