X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=twitter%2Ftwitter_sync.php;h=7ff3dbb3781d7042af99fc5714690bf71b244e43;hb=7ea817b71bd11bca5d302cdd187bc550ac71d4b5;hp=fd1915d8b44d47a5e78ec7d07082b319618fadd6;hpb=8fa3f2415a3f3906f5fdadd1601ec6830ecce3c9;p=friendica-addons.git diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index fd1915d8..7ff3dbb3 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -1,45 +1,16 @@ $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; } @@ -52,33 +23,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(); -} -?>