drastic speedup through multicalls
This commit is contained in:
@ -252,10 +252,19 @@ class CallbackManager implements UsageInformationAble {
|
||||
$timings[$key] = array($callback[0], microtime(true) - $time1);
|
||||
}
|
||||
|
||||
//Execute Multicalls
|
||||
$this->maniaControl->getClient()->executeMulticall();
|
||||
|
||||
$fullTime = microtime(true) - $startTime;
|
||||
|
||||
if ($fullTime > ErrorHandler::LONG_LOOP_REPORT_TIME) {
|
||||
$this->maniaControl->getErrorHandler()->triggerDebugNotice(json_encode(array("Long Loop Detected: " . $fullTime, $timings)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,12 +72,11 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendInformation($message, $login = null, $prefix = true, $multiCall = false) {
|
||||
public function sendInformation($message, $login = null, $prefix = true) {
|
||||
$format = $this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_FORMAT_INFORMATION);
|
||||
return $this->sendChat($format . $message, $login, $prefix, $multiCall);
|
||||
return $this->sendChat($format . $message, $login, $prefix);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,10 +85,9 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
* @param string $message
|
||||
* @param string $login
|
||||
* @param string|bool $prefix
|
||||
* @param bool $multiCall
|
||||
* @return bool
|
||||
*/
|
||||
public function sendChat($message, $login = null, $prefix = true, $multiCall = false) {
|
||||
public function sendChat($message, $login = null, $prefix = true) {
|
||||
if (!$this->maniaControl->getClient()) {
|
||||
return false;
|
||||
}
|
||||
@ -102,13 +100,13 @@ class Chat implements CallbackListener, CommunicationListener, UsageInformationA
|
||||
$login = Player::parseLogin($login);
|
||||
}
|
||||
try {
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, $multiCall);
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, $login, true);
|
||||
} catch (UnknownPlayerException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, $multiCall);
|
||||
return $this->maniaControl->getClient()->chatSendServerMessage($chatMessage, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -241,13 +241,13 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener,
|
||||
|
||||
try {
|
||||
if (!$logins) {
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage(null, $manialinkText, $timeout, $hideOnClick);
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage(null, $manialinkText, $timeout, $hideOnClick, true);
|
||||
}
|
||||
if (is_string($logins)) {
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage($logins, $manialinkText, $timeout, $hideOnClick);
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage($logins, $manialinkText, $timeout, $hideOnClick, true);
|
||||
}
|
||||
if ($logins instanceof Player) {
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage($logins->login, $manialinkText, $timeout, $hideOnClick);
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage($logins->login, $manialinkText, $timeout, $hideOnClick, true);
|
||||
}
|
||||
if (is_array($logins)) {
|
||||
$loginList = array();
|
||||
@ -258,7 +258,7 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener,
|
||||
$loginList[] = $login;
|
||||
}
|
||||
}
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage(implode(',', $loginList), $manialinkText, $timeout, $hideOnClick);
|
||||
return $this->maniaControl->getClient()->sendDisplayManialinkPage(implode(',', $loginList), $manialinkText, $timeout, $hideOnClick, true);
|
||||
}
|
||||
} catch (UnknownPlayerException $e) {
|
||||
return false;
|
||||
|
@ -410,7 +410,7 @@ class MapQueue implements CallbackListener, CommandListener, UsageInformationAbl
|
||||
}
|
||||
|
||||
try {
|
||||
$this->maniaControl->getClient()->setNextMapIdent($map->uid);
|
||||
$this->maniaControl->getClient()->setNextMapIdent($map->uid, true);
|
||||
} catch (NextMapException $e) {
|
||||
} catch (NotInListException $e) {
|
||||
}
|
||||
|
@ -533,14 +533,14 @@ class ModeScriptEventManager implements UsageInformationAble {
|
||||
* @param string $data
|
||||
*/
|
||||
public function triggerModeScriptEvent($eventName, $data = '') {
|
||||
try {
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent($eventName, $data);
|
||||
} catch (GameModeException $e) {
|
||||
if ($e->getMessage() != 'Not in script mode.') {
|
||||
throw $e;
|
||||
$this->maniaControl->getClient()->triggerModeScriptEvent($eventName, $data, function ($exception) use ($eventName) {
|
||||
if ($exception instanceof GameModeException) {
|
||||
if ($exception->getMessage() != 'Not in script mode.') {
|
||||
throw $exception;
|
||||
}
|
||||
Logger::logWarning($eventName . " can't be triggered because you are not in Scriptmode, start your server in Scriptmode!");
|
||||
}
|
||||
Logger::logWarning($eventName . " can't be triggered because you are not in Scriptmode, start your server in Scriptmode!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user