mirror of
https://github.com/php/frankenphp.git
synced 2026-03-24 00:52:11 +01:00
committed by
Kévin Dunglas
parent
9b8d215727
commit
1270784cd3
10
worker.go
10
worker.go
@@ -23,6 +23,8 @@ type worker struct {
|
||||
threadMutex sync.RWMutex
|
||||
allowPathMatching bool
|
||||
maxConsecutiveFailures int
|
||||
onThreadReady func(int)
|
||||
onThreadShutdown func(int)
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -51,12 +53,6 @@ func initWorkers(opt []workerOpt) error {
|
||||
convertToWorkerThread(thread, w)
|
||||
go func() {
|
||||
thread.state.waitFor(stateReady)
|
||||
|
||||
// create a pipe from the external worker to the main worker
|
||||
// note: this is locked to the initial thread size the external worker requested
|
||||
if workerThread, ok := thread.handler.(*workerThread); ok && workerThread.externalWorker != nil {
|
||||
go startWorker(w, workerThread.externalWorker, thread)
|
||||
}
|
||||
workersReady.Done()
|
||||
}()
|
||||
}
|
||||
@@ -131,6 +127,8 @@ func newWorker(o workerOpt) (*worker, error) {
|
||||
threads: make([]*phpThread, 0, o.num),
|
||||
allowPathMatching: allowPathMatching,
|
||||
maxConsecutiveFailures: o.maxConsecutiveFailures,
|
||||
onThreadReady: o.onThreadReady,
|
||||
onThreadShutdown: o.onThreadShutdown,
|
||||
}
|
||||
|
||||
return w, nil
|
||||
|
||||
Reference in New Issue
Block a user