@@ -12,6 +12,7 @@ import (
1212 "strconv"
1313 "strings"
1414 "time"
15+ "unsafe"
1516
1617 "github.com/dunglas/frankenphp/internal/fastabs"
1718
@@ -59,7 +60,7 @@ type workerConfig struct {
5960 // Directories to watch for file changes
6061 Watch []string `json:"watch,omitempty"`
6162 // ModuleID identifies which module created this worker
62- ModuleID string `json:"module_id,omitempty"`
63+ ModuleID uintptr `json:"module_id,omitempty"`
6364}
6465
6566type FrankenPHPApp struct {
@@ -119,7 +120,7 @@ func (f *FrankenPHPApp) Start() error {
119120 opts = append (opts , frankenphp .WithWorkers (w .Name , repl .ReplaceKnown (w .FileName , "" ), w .Num , w .Env , w .Watch , w .ModuleID ))
120121 }
121122
122- // Add workers from shared location (added by FrankenPHPModule)
123+ // Add workers from FrankenPHPModule configurations
123124 for _ , w := range moduleWorkers {
124125 opts = append (opts , frankenphp .WithWorkers (w .Name , repl .ReplaceKnown (w .FileName , "" ), w .Num , w .Env , w .Watch , w .ModuleID ))
125126 }
@@ -147,7 +148,7 @@ func (f *FrankenPHPApp) Stop() error {
147148 f .NumThreads = 0
148149 f .MaxWaitTime = 0
149150
150- // reset shared workers
151+ // reset moduleWorkers
151152 moduleWorkers = nil
152153
153154 return nil
@@ -376,7 +377,6 @@ func (FrankenPHPModule) CaddyModule() caddy.ModuleInfo {
376377// Provision sets up the module.
377378func (f * FrankenPHPModule ) Provision (ctx caddy.Context ) error {
378379 f .logger = ctx .Logger ()
379- f .logger .Info ("FrankenPHPModule provisioning 🐘" )
380380
381381 if f .Root == "" {
382382 if frankenphp .EmbeddedAppPath == "" {
@@ -432,9 +432,8 @@ func (f *FrankenPHPModule) Provision(ctx caddy.Context) error {
432432
433433 if len (f .Workers ) > 0 {
434434 // Tag workers with a unique module ID based on the module's memory address
435- moduleID := fmt .Sprintf ("%p" , f )
436435 for i := range f .Workers {
437- f .Workers [i ].ModuleID = moduleID
436+ f .Workers [i ].ModuleID = uintptr ( unsafe . Pointer ( f ))
438437 }
439438 moduleWorkers = append (moduleWorkers , f .Workers ... )
440439 }
@@ -474,7 +473,7 @@ func (f *FrankenPHPModule) ServeHTTP(w http.ResponseWriter, r *http.Request, _ c
474473 frankenphp .WithRequestSplitPath (f .SplitPath ),
475474 frankenphp .WithRequestPreparedEnv (env ),
476475 frankenphp .WithOriginalRequest (& origReq ),
477- frankenphp .WithModuleID (fmt . Sprintf ( "%p" , f )),
476+ frankenphp .WithModuleID (uintptr ( unsafe . Pointer ( f ) )),
478477 )
479478
480479 if err != nil {
0 commit comments