diff --git a/local/php/executor.go b/local/php/executor.go index 91d384cd..b3123788 100644 --- a/local/php/executor.go +++ b/local/php/executor.go @@ -292,13 +292,22 @@ func (e *Executor) Config(loadDotEnv bool) error { } func (e *Executor) CleanupTemporaryDirectories() { - go cleanupStaleTemporaryDirectories(e.Logger) + backgroundCleanup := make(chan bool, 1) + go cleanupStaleTemporaryDirectories(e.Logger, backgroundCleanup) + if e.iniDir != "" { os.RemoveAll(e.iniDir) } if e.tempDir != "" { os.RemoveAll(e.tempDir) } + + // give some room to the background clean up job to do its work + select { + case <-backgroundCleanup: + case <-time.After(100 * time.Millisecond): + e.Logger.Debug().Msg("Allocated time for temporary directories to be cleaned up is over, it will resume later on") + } } // The Symfony CLI used to leak temporary directories until v5.10.8. The bug is @@ -307,7 +316,10 @@ func (e *Executor) CleanupTemporaryDirectories() { // in-use by running servers we can't simply delete the parent directory. This // is why we make our best to find the oldest directories and remove then, // cleaning the directory little by little. -func cleanupStaleTemporaryDirectories(mainLogger zerolog.Logger) { +func cleanupStaleTemporaryDirectories(mainLogger zerolog.Logger, doneCh chan<- bool) { + defer func() { + doneCh <- true + }() parentDirectory := filepath.Join(util.GetHomeDir(), "tmp") mainLogger = mainLogger.With().Str("dir", parentDirectory).Logger() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy