performance tweek
This commit is contained in:
parent
931246cfee
commit
ca461d214c
@ -76,6 +76,7 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
*/
|
*/
|
||||||
/** @var ManiaControl $maniaControl */
|
/** @var ManiaControl $maniaControl */
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
|
private $lastWidgetUpdateTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see \ManiaControl\Plugins\Plugin::prepare()
|
* @see \ManiaControl\Plugins\Plugin::prepare()
|
||||||
@ -555,7 +556,12 @@ class WidgetPlugin implements CallbackListener, TimerListener, Plugin {
|
|||||||
*/
|
*/
|
||||||
public function updateWidgets() {
|
public function updateWidgets() {
|
||||||
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
if ($this->maniaControl->getSettingManager()->getSettingValue($this, self::SETTING_SERVERINFO_WIDGET_ACTIVATED)) {
|
||||||
|
$time = time();
|
||||||
|
//Update Max once per second
|
||||||
|
if ($this->lastWidgetUpdateTime < ($time - 1)) {
|
||||||
$this->displayServerInfoWidget();
|
$this->displayServerInfoWidget();
|
||||||
|
$this->lastWidgetUpdateTime = $time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user