Add interval timers to thread update and expire

This commit is contained in:
Retro_Guy 2021-01-08 18:41:29 -07:00
parent b25d8a0c9f
commit 4d3645b33c
2 changed files with 15 additions and 3 deletions

View File

@ -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');
?>

View File

@ -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);