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 "config.inc.php";
include ("$file_newsportal"); include ("$file_newsportal");
if(filemtime($spooldir.'/'.$config_name.'-expire-timer')+86400 > time()) {
exit;
}
$lockfile = sys_get_temp_dir() . '/'.$config_name.'-spoolnews.lock'; $lockfile = sys_get_temp_dir() . '/'.$config_name.'-spoolnews.lock';
$pid = file_get_contents($lockfile); $pid = file_get_contents($lockfile);
if (posix_getsid($pid) === false || !is_file($lockfile)) { if (posix_getsid($pid) === false || !is_file($lockfile)) {
@ -65,4 +68,5 @@
} }
$dbh = null; $dbh = null;
unlink($lockfile); unlink($lockfile);
touch($spooldir.'/'.$config_name.'-expire-timer');
?> ?>

View File

@ -64,6 +64,13 @@ if(is_file($sem)) {
$maxfirstrequest = 20; $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 # Check for groups file, create if necessary
create_spool_groups($file_groups, $remote_groupfile); create_spool_groups($file_groups, $remote_groupfile);
create_spool_groups($file_groups, $local_groupfile); create_spool_groups($file_groups, $local_groupfile);
@ -96,10 +103,11 @@ foreach($grouplist as $findgroup) {
get_articles($ns, $name[0]); get_articles($ns, $name[0]);
if($enable_rslight == 1) { if($enable_rslight == 1) {
file_put_contents($logfile, "\n".format_log_date()." ".$config_name." Updating threads for: ".$name[0]."...", FILE_APPEND); if($timer) {
thread_load_newsserver($ns2,$name[0],0); 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($ns2);
nntp_close($ns); nntp_close($ns);