X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=twitter%2Ftwitter_sync.php;h=092a61edf0a450534b981d2ac99a1b573bbaee31;hb=8764f5205a7c97ad737fea1bd5b919bcbb2673c4;hp=49c4135477da7f1d65004e95d2c9144558df422e;hpb=0111149248400025ca5fce3663d78d9b65a43391;p=friendica-addons.git diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index 49c41354..092a61ed 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -1,46 +1,19 @@ $maxsysload) { - logger('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.'); + $maxload = DI::config()->get('system', 'maxloadavg', 50); + if (intval($load[0]) > $maxload) { + Logger::notice('load too high. Twitter sync deferred to next scheduled run.', ['current' => $load[0], 'max' => $maxload]); return; } } @@ -52,33 +25,9 @@ function twitter_sync_run($argv, $argc){ $mode = intval($argv[1]); $uid = intval($argv[2]); - // This is deprecated with the worker - if (function_exists("get_lockpath")) { - $lockpath = get_lockpath(); - if ($lockpath != '') { - $pidfile = new pidfile($lockpath, 'twitter_sync-'.$mode.'-'.$uid); - if ($pidfile->is_already_running()) { - logger("Already running"); - if ($pidfile->running_time() > 9*60) { - $pidfile->kill(); - logger("killed stale process"); - // Calling a new instance - proc_run('php','addon/twitter/twitter_sync.php', $mode, $uid); - } - exit; - } - } - } - if ($mode == 1) { twitter_fetchtimeline($a, $uid); } elseif ($mode == 2) { twitter_fetchhometimeline($a, $uid); } } - -if (array_search(__file__,get_included_files())===0){ - twitter_sync_run($_SERVER["argv"],$_SERVER["argc"]); - killme(); -} -?>