- improved "deleteLogData()" cronjob -> reduced exec. time from 1h -> 10min

This commit is contained in:
Exodus4D
2016-09-03 17:20:16 +02:00
parent 110128b0e4
commit e20df901dc
4 changed files with 24 additions and 19 deletions

View File

@@ -10,7 +10,10 @@ instant = * * * * *
; run on EVE downtime 11:00 GMT/UTC
downtime = 0 11 * * *
; half hour (each 30min)
; 6 times per hour (each 10min)
sixthHour = */10 * * * *
; 2 times per hour (each 30min)
halfHour = */30 * * * *
[CRON.jobs]
@@ -21,7 +24,7 @@ importSystemData = Cron\CcpSystemsUpdate->importSystemData,
deactivateMapData = Cron\MapUpdate->deactivateMapData, @hourly
; delete character log data
deleteLogData = Cron\CharacterUpdate->deleteLogData, @hourly
deleteLogData = Cron\CharacterUpdate->deleteLogData, @sixthHour
; delete disabled maps
deleteMapData = Cron\MapUpdate->deleteMapData, @downtime

View File

@@ -7,7 +7,6 @@
*/
namespace cron;
use Controller;
use DB;
use Model;
@@ -20,22 +19,26 @@ class CharacterUpdate {
* @param \Base $f3
*/
function deleteLogData($f3){
DB\Database::instance()->getDB('PF');
$logExpire = (int)$f3->get('PATHFINDER.CACHE.CHARACTER_LOG');
/**
* @var $characterLogModel Model\CharacterLogModel
*/
$characterLogModel = Model\BasicModel::getNew('CharacterLogModel', 0);
if($logExpire > 0){
DB\Database::instance()->getDB('PF');
// find expired character logs
$characterLogs = $characterLogModel->find([
'TIMESTAMPDIFF(SECOND, updated, NOW() ) > :lifetime',
':lifetime' => (int)$f3->get('PATHFINDER.CACHE.CHARACTER_LOG')
]);
/**
* @var $characterLogModel Model\CharacterLogModel
*/
$characterLogModel = Model\BasicModel::getNew('CharacterLogModel', 0);
if(is_object($characterLogs)){
foreach($characterLogs as $characterLog){
$characterLog->erase();
// find expired character logs
$characterLogs = $characterLogModel->find([
'TIMESTAMPDIFF(SECOND, updated, NOW() ) > :lifetime',
':lifetime' => $logExpire
]);
if(is_object($characterLogs)){
foreach($characterLogs as $characterLog){
$characterLog->erase();
}
}
}
}

View File

@@ -444,7 +444,6 @@ class CharacterModel extends BasicModel {
* @return bool|CharacterLogModel
*/
public function getLog(){
$characterLog = false;
if(
is_object($this->characterLog) &&

View File

@@ -104,13 +104,13 @@ EXECUTION_LIMIT = 50
; CACHE ===========================================================================================
[PATHFINDER.CACHE]
; expire time for character log data (seconds). (default: 300s)
; expire time for character log data (seconds) (default: 5min)
CHARACTER_LOG = 300
; expire time for static system data (seconds) (default: 30d)
CONSTELLATION_SYSTEMS = 2592000
; max expire time. Expired cache files will be deleted by cronjob (seconds) (default: 60d)
EXPIRE_MAX = 5184000
; expire time for signatures (inactive systems) (seconds). (default 3d)
; expire time for signatures (inactive systems) (seconds) (default 3d)
EXPIRE_SIGNATURES = 259200
; LOGGING =========================================================================================