From 4d3645b33c3860133392f42307e49a25c6c7212c Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Fri, 8 Jan 2021 18:41:29 -0700 Subject: [PATCH] Add interval timers to thread update and expire --- Rocksolid_Light/rslight/scripts/expire.php | 4 ++++ Rocksolid_Light/rslight/scripts/spoolnews.php | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/expire.php b/Rocksolid_Light/rslight/scripts/expire.php index f72e881..1caaaa5 100755 --- a/Rocksolid_Light/rslight/scripts/expire.php +++ b/Rocksolid_Light/rslight/scripts/expire.php @@ -3,6 +3,9 @@ include "config.inc.php"; include ("$file_newsportal"); + if(filemtime($spooldir.'/'.$config_name.'-expire-timer')+86400 > time()) { + exit; + } $lockfile = sys_get_temp_dir() . '/'.$config_name.'-spoolnews.lock'; $pid = file_get_contents($lockfile); if (posix_getsid($pid) === false || !is_file($lockfile)) { @@ -65,4 +68,5 @@ } $dbh = null; unlink($lockfile); + touch($spooldir.'/'.$config_name.'-expire-timer'); ?> diff --git a/Rocksolid_Light/rslight/scripts/spoolnews.php b/Rocksolid_Light/rslight/scripts/spoolnews.php index 9ae96ad..b6a52dd 100755 --- a/Rocksolid_Light/rslight/scripts/spoolnews.php +++ b/Rocksolid_Light/rslight/scripts/spoolnews.php @@ -64,6 +64,13 @@ if(is_file($sem)) { $maxfirstrequest = 20; } +if(filemtime($spooldir.'/'.$config_name.'-thread-timer')+600 < time()) { + $timer=true; + touch($spooldir.'/'.$config_name.'-thread-timer'); +} else { + $timer=false; +} + # Check for groups file, create if necessary create_spool_groups($file_groups, $remote_groupfile); create_spool_groups($file_groups, $local_groupfile); @@ -96,10 +103,11 @@ foreach($grouplist as $findgroup) { get_articles($ns, $name[0]); if($enable_rslight == 1) { - file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Updating threads for: ".$name[0]."...", FILE_APPEND); - thread_load_newsserver($ns2,$name[0],0); + if($timer) { + file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Updating threads for: ".$name[0]."...", FILE_APPEND); + thread_load_newsserver($ns2,$name[0],0); + } } - } nntp_close($ns2); nntp_close($ns);