private function receiveResponses() { $results = $this->database->execute('SELECT commandId, threadId, result, timeTaken FROM ThreadingCommands WHERE result IS NOT NULL AND parentId=%d', getmypid()); if (!$results->recordAvailable()) { return; } $ids = array(); while ($result = $results->fetchArray()) { $commandId = (int) $result['commandId']; $threadId = (int) $result['threadId']; $timeTaken = (double) $result['timeTaken']; Console::printDebug('Got response for Command #' . $commandId . ' finished by Thread #' . $threadId . ' in ' . round($timeTaken, 3) . ' ms!'); if (isset($this->pendings[$threadId][$commandId])) { $command = $this->pendings[$threadId][$commandId]; $command->setResult(unserialize(base64_decode($result['result'])), $timeTaken); unset($this->pendings[$threadId][$commandId]); unset($this->tries[$commandId]); } if (isset($this->lastTick[$threadId])) { $this->lastTick[$threadId] = $this->tick; } ++$this->commandsCount; $this->commandsTotalTime += $timeTaken; $this->commandsAverageTime = $this->commandsTotalTime / $this->commandsCount; $ids[] = $commandId; } $this->database->execute('DELETE FROM ThreadingCommands WHERE commandId IN (%s) AND parentId=%d', implode(',', $ids), getmypid()); }