diff --git a/phpmainthread.go b/phpmainthread.go index cecadc16..e10ce9e4 100644 --- a/phpmainthread.go +++ b/phpmainthread.go @@ -79,6 +79,9 @@ func initPHPThreads(numThreads int, numMaxThreads int, phpIni map[string]string) } func drainPHPThreads() { + if mainThread == nil { + return // mainThread was never initialized + } doneWG := sync.WaitGroup{} doneWG.Add(len(phpThreads)) mainThread.state.Set(state.ShuttingDown) diff --git a/phpmainthread_test.go b/phpmainthread_test.go index 7e6bf32c..b54647ae 100644 --- a/phpmainthread_test.go +++ b/phpmainthread_test.go @@ -96,7 +96,7 @@ func TestTransitionThreadsWhileDoingRequests(t *testing.T) { var ( isDone atomic.Bool - wg sync.WaitGroup + wg sync.WaitGroup ) numThreads := 10 diff --git a/watcher.go b/watcher.go index eb2b09e2..cfe133e5 100644 --- a/watcher.go +++ b/watcher.go @@ -10,7 +10,7 @@ import ( ) type hotReloadOpt struct { - hotReload []*watcher.PatternGroup + hotReload []*watcher.PatternGroup } var restartWorkers atomic.Bool