X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=twitter%2Ftwitter_sync.php;h=092a61edf0a450534b981d2ac99a1b573bbaee31;hb=5ea82418d8bda7ac7d484f766571892e1719486d;hp=434cb20421132b2315938b368aa7292aa313973e;hpb=cd4af64ff2fd1dfa275c78905acc5e409d2599b9;p=friendica-addons.git diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index 434cb204..092a61ed 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -1,43 +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; } } @@ -49,31 +25,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(); -} -?>