logger = $logger; $this->id = $id; $this->memoryLimit = $memoryLimit; } public function run(){ $this->registerClassLoader(); $this->logger->registerStatic(); gc_enable(); if($this->memoryLimit > 0){ ini_set('memory_limit', $this->memoryLimit . 'M'); $this->logger->debug("Set memory limit to " . $this->memoryLimit . " MB"); }else{ ini_set('memory_limit', '-1'); $this->logger->debug("No memory limit set"); } global $store; $store = []; } public function handleException(\Throwable $e){ $this->logger->logException($e); } public function getThreadName() : string{ return "Asynchronous Worker #" . $this->id; } }