reduce delete calls because of heave db load
This commit is contained in:
parent
c0a59c7196
commit
dac3ae9b23
@ -32,6 +32,8 @@ class d3usersonline extends oxbase
|
|||||||
protected $_httpXComingFrom = null;
|
protected $_httpXComingFrom = null;
|
||||||
protected $_httpComingFrom = null;
|
protected $_httpComingFrom = null;
|
||||||
|
|
||||||
|
protected $_iDeleteThreshold = 30; // Zeitdifferenz für Löschaufträge
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*/
|
*/
|
||||||
@ -48,9 +50,16 @@ class d3usersonline extends oxbase
|
|||||||
{
|
{
|
||||||
startProfile(__METHOD__);
|
startProfile(__METHOD__);
|
||||||
|
|
||||||
$iExptime = time() - $iExpTime;
|
$iTime = time();
|
||||||
|
$iLastDeleteTime = oxRegistry::getConfig()->getShopConfVar('iLastDeleteTime', null, 'd3usersonline');
|
||||||
|
|
||||||
|
if ($iTime > $iLastDeleteTime + $this->_iDeleteThreshold) {
|
||||||
|
$iExptime = $iTime - $iExpTime;
|
||||||
oxDb::getDb()->Execute("delete from " . $this->getViewName() . " where timevisit < $iExptime");
|
oxDb::getDb()->Execute("delete from " . $this->getViewName() . " where timevisit < $iExptime");
|
||||||
|
|
||||||
|
oxRegistry::getConfig()->saveShopConfVar('int', 'iLastDeleteTime', $iTime, null, 'd3usersonline');
|
||||||
|
}
|
||||||
|
|
||||||
stopProfile(__METHOD__);
|
stopProfile(__METHOD__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +72,7 @@ class d3usersonline extends oxbase
|
|||||||
|
|
||||||
$sSelect = "select count(oxid) AS counter, oxclass from ".
|
$sSelect = "select count(oxid) AS counter, oxclass from ".
|
||||||
$this->getViewName()." GROUP BY oxclass ORDER BY counter desc";
|
$this->getViewName()." GROUP BY oxclass ORDER BY counter desc";
|
||||||
$aRecords = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getArray($sSelect);
|
$aRecords = oxDb::getDb(oxDb::FETCH_MODE_ASSOC)->getAll($sSelect);
|
||||||
|
|
||||||
$iAllCounter = 0;
|
$iAllCounter = 0;
|
||||||
$aUserClasses = array();
|
$aUserClasses = array();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user