mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 05:04:22 +00:00
chore(xray): minor cleanups to graceful-shutdown follow-ups for #4259
- Remove unreachable p.done == nil guard in waitForExit (set in startCommand) - Bump TestStopWaitsForGracefulExit margin to 180ms (helper sleeps 200ms) - 0644 -> 0o644 for Go style
This commit is contained in:
parent
dd18130ece
commit
341eb5b63b
2 changed files with 2 additions and 6 deletions
|
|
@ -436,10 +436,6 @@ func (p *process) Stop() error {
|
|||
}
|
||||
|
||||
func (p *process) waitForExit(timeout time.Duration) error {
|
||||
if p.done == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
timer := time.NewTimer(timeout)
|
||||
defer timer.Stop()
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ func TestStopWaitsForGracefulExit(t *testing.T) {
|
|||
if err := p.Stop(); err != nil {
|
||||
t.Fatalf("Stop: %v", err)
|
||||
}
|
||||
if elapsed := time.Since(start); elapsed < 150*time.Millisecond {
|
||||
if elapsed := time.Since(start); elapsed < 180*time.Millisecond {
|
||||
t.Fatalf("Stop returned before child exited; elapsed=%s", elapsed)
|
||||
}
|
||||
if p.IsRunning() {
|
||||
|
|
@ -156,7 +156,7 @@ func markProcessHelperReady(t *testing.T) {
|
|||
if readyPath == "" {
|
||||
t.Fatal("XRAY_PROCESS_READY is not set")
|
||||
}
|
||||
if err := os.WriteFile(readyPath, []byte("ready"), 0644); err != nil {
|
||||
if err := os.WriteFile(readyPath, []byte("ready"), 0o644); err != nil {
|
||||
t.Fatalf("write helper ready file: %v", err)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue