@@ -21,13 +21,10 @@ type workerThread struct {
2121 dummyContext * frankenPHPContext
2222 workerContext * frankenPHPContext
2323 backoff * exponentialBackoff
24- externalWorker Worker
2524 isBootingScript bool // true if the worker has not reached frankenphp_handle_request yet
2625}
2726
2827func convertToWorkerThread (thread * phpThread , worker * worker ) {
29- externalWorker := extensionWorkers [worker .name ]
30-
3128 thread .setHandler (& workerThread {
3229 state : thread .state ,
3330 thread : thread ,
@@ -37,7 +34,6 @@ func convertToWorkerThread(thread *phpThread, worker *worker) {
3734 minBackoff : 100 * time .Millisecond ,
3835 maxConsecutiveFailures : worker .maxConsecutiveFailures ,
3936 },
40- externalWorker : externalWorker ,
4137 })
4238 worker .attachThread (thread )
4339}
@@ -46,27 +42,27 @@ func convertToWorkerThread(thread *phpThread, worker *worker) {
4642func (handler * workerThread ) beforeScriptExecution () string {
4743 switch handler .state .get () {
4844 case stateTransitionRequested :
49- if handler .externalWorker != nil {
50- handler .externalWorker . OnServerShutdown (handler .thread .threadIndex )
45+ if handler .worker . onThreadShutdown != nil {
46+ handler .worker . onThreadShutdown (handler .thread .threadIndex )
5147 }
5248 handler .worker .detachThread (handler .thread )
5349 return handler .thread .transitionToNewHandler ()
5450 case stateRestarting :
55- if handler .externalWorker != nil {
56- handler .externalWorker . OnShutdown (handler .thread .threadIndex )
51+ if handler .worker . onThreadShutdown != nil {
52+ handler .worker . onThreadShutdown (handler .thread .threadIndex )
5753 }
5854 handler .state .set (stateYielding )
5955 handler .state .waitFor (stateReady , stateShuttingDown )
6056 return handler .beforeScriptExecution ()
6157 case stateReady , stateTransitionComplete :
62- if handler .externalWorker != nil {
63- handler .externalWorker . OnReady (handler .thread .threadIndex )
58+ if handler .worker . onThreadReady != nil {
59+ handler .worker . onThreadReady (handler .thread .threadIndex )
6460 }
6561 setupWorkerScript (handler , handler .worker )
6662 return handler .worker .fileName
6763 case stateShuttingDown :
68- if handler .externalWorker != nil {
69- handler .externalWorker . OnServerShutdown (handler .thread .threadIndex )
64+ if handler .worker . onThreadShutdown != nil {
65+ handler .worker . onThreadShutdown (handler .thread .threadIndex )
7066 }
7167 handler .worker .detachThread (handler .thread )
7268 // signal to stop
0 commit comments