X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=twitter%2Ftwitter_sync.php;h=5d6e8b2ffb28d30be9e5f19cda4b0490d587468d;hb=46e09b05440fac8984ffc777b1dff4a765fcabf6;hp=434cb20421132b2315938b368aa7292aa313973e;hpb=cd4af64ff2fd1dfa275c78905acc5e409d2599b9;p=friendica-addons.git diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index 434cb204..5d6e8b2f 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -1,42 +1,14 @@ $maxsysload) { + if (intval($load[0]) > Config::get('system', 'maxloadavg', 50)) { logger('system: load ' . $load[0] . ' too high. Twitter sync deferred to next scheduled run.'); return; } @@ -49,31 +21,10 @@ 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(); -} ?>