Changed cron uploader to better handle concurrent run attmpts

This commit is contained in:
Matthew Barbour 2020-12-29 12:06:08 -06:00
parent e7d11f2310
commit 6282881c4a

View file

@ -119,12 +119,14 @@ class CronUploader extends Extension
public function onLog(LogEvent $event) public function onLog(LogEvent $event)
{ {
global $user_config; global $user_config;
if (self::$IMPORT_RUNNING) {
$all = $user_config->get_bool(CronUploaderConfig::INCLUDE_ALL_LOGS); $all = $user_config->get_bool(CronUploaderConfig::INCLUDE_ALL_LOGS);
if (self::$IMPORT_RUNNING && if($event->priority >= $user_config->get_int(CronUploaderConfig::LOG_LEVEL) &&
$event->priority >= $user_config->get_int(CronUploaderConfig::LOG_LEVEL) && ($event->section==self::NAME || $all)) {
($event->section==self::NAME || $all)
) {
$output = "[" . date('Y-m-d H:i:s') . "] " . ($all ? '['. $event->section .'] ' :'') . "[" . LOGGING_LEVEL_NAMES[$event->priority] . "] " . $event->message ; $output = "[" . date('Y-m-d H:i:s') . "] " . ($all ? '[' . $event->section . '] ' : '') . "[" . LOGGING_LEVEL_NAMES[$event->priority] . "] " . $event->message;
echo $output . "\r\n"; echo $output . "\r\n";
flush_output(); flush_output();
@ -133,6 +135,7 @@ class CronUploader extends Extension
file_put_contents($log_path, $output); file_put_contents($log_path, $output);
} }
} }
}
private function restage_folder(string $folder) private function restage_folder(string $folder)
{ {