MCPcopy Index your code
hub / github.com/php/frankenphp / setupWorkerScript

Function setupWorkerScript

threadworker.go:110–133  ·  view source on GitHub ↗
(handler *workerThread, worker *worker)

Source from the content-addressed store, hash-verified

108func (handler *workerThread) drain() {}
109
110func setupWorkerScript(handler *workerThread, worker *worker) {
111 metrics.StartWorker(worker.name)
112
113 // Create a dummy request to set up the worker
114 fc, err := newDummyContext(
115 filepath.Base(worker.fileName),
116 worker.requestOptions...,
117 )
118 if err != nil {
119 panic(err)
120 }
121
122 ctx := context.WithValue(globalCtx, contextKey, fc)
123
124 fc.worker = worker
125 handler.dummyFrankenPHPContext = fc
126 handler.dummyContext = ctx
127 handler.isBootingScript = true
128 handler.requestCount = 0
129
130 if globalLogger.Enabled(ctx, slog.LevelDebug) {
131 globalLogger.LogAttrs(ctx, slog.LevelDebug, "starting", slog.String("worker", worker.name), slog.Int("thread", handler.thread.threadIndex))
132 }
133}
134
135func tearDownWorkerScript(handler *workerThread, exitStatus int) {
136 worker := handler.worker

Callers 1

beforeScriptExecutionMethod · 0.85

Calls 3

newDummyContextFunction · 0.85
StartWorkerMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected