X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=twitter%2Ftwitter_sync.php;h=b2c655e7c809b0fb6e00cdfad159d9d6b77745cb;hb=4ab75e2e8cb5e3c422d2c45e52a5a12d73ecfdbf;hp=e8987f8f6adc73984693e9591a28cb492af3f162;hpb=9f18d7e6ded53ce9338c624ed4228315581fb217;p=friendica-addons.git diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index e8987f8f..b2c655e7 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -1,42 +1,18 @@ $maxsysload) { - logger('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.'); + if (intval($load[0]) > Config::get('system', 'maxloadavg', 50)) { + Logger::log('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.'); return; } } @@ -48,31 +24,9 @@ function twitter_sync_run($argv, $argc){ $mode = intval($argv[1]); $uid = intval($argv[2]); - /// @todo Replace it with "App::is_already_running" in the next release - $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(); -} -?>