@@ -20,8 +20,6 @@ const (
2020 cpuProbeTime = 120 * time .Millisecond
2121 // do not scale over this amount of CPU usage
2222 maxCpuUsageForScaling = 0.8
23- // upscale stalled threads every x milliseconds
24- upscaleCheckTime = 100 * time .Millisecond
2523 // downscale idle threads every x seconds
2624 downScaleCheckTime = 5 * time .Second
2725 // max amount of threads stopped in one iteration of downScaleCheckTime
@@ -31,13 +29,11 @@ const (
3129)
3230
3331var (
32+ ErrMaxThreadsReached = errors .New ("max amount of overall threads reached" )
33+
3434 scaleChan chan * frankenPHPContext
3535 autoScaledThreads = []* phpThread {}
3636 scalingMu = new (sync.RWMutex )
37-
38- MaxThreadsReachedError = errors .New ("max amount of overall threads reached" )
39- CannotRemoveLastThreadError = errors .New ("cannot remove last thread" )
40- WorkerNotFoundError = errors .New ("worker not found for given filename" )
4137)
4238
4339func initAutoScaling (mainThread * phpMainThread ) {
@@ -67,7 +63,7 @@ func drainAutoScaling() {
6763func addRegularThread () (* phpThread , error ) {
6864 thread := getInactivePHPThread ()
6965 if thread == nil {
70- return nil , MaxThreadsReachedError
66+ return nil , ErrMaxThreadsReached
7167 }
7268 convertToRegularThread (thread )
7369 thread .state .waitFor (stateReady , stateShuttingDown , stateReserved )
@@ -77,7 +73,7 @@ func addRegularThread() (*phpThread, error) {
7773func addWorkerThread (worker * worker ) (* phpThread , error ) {
7874 thread := getInactivePHPThread ()
7975 if thread == nil {
80- return nil , MaxThreadsReachedError
76+ return nil , ErrMaxThreadsReached
8177 }
8278 convertToWorkerThread (thread , worker )
8379 thread .state .waitFor (stateReady , stateShuttingDown , stateReserved )
0 commit comments