From: Michael R Sweet Date: Thu, 21 Feb 2019 17:31:38 +0000 (-0500) Subject: Rework the idle exit fix after some discussion. X-Git-Tag: v2.2.11~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=469b6abcd81aeef0b6b1c3627ff63d801e9ae2a7;p=thirdparty%2Fcups.git Rework the idle exit fix after some discussion. --- diff --git a/scheduler/main.c b/scheduler/main.c index e96337086f..588aadc85d 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -807,7 +807,7 @@ main(int argc, /* I - Number of command-line args */ * inactivity... */ - if (OnDemand && IdleExitTimeout && + if (timeout == 86400 && OnDemand && IdleExitTimeout && # ifdef HAVE_SYSTEMD !WebInterface && # endif /* HAVE_SYSTEMD */ @@ -992,6 +992,23 @@ main(int argc, /* I - Number of command-line args */ } #endif /* !HAVE_AUTHORIZATION_H */ + /* + * Clean job history... + */ + + if (JobHistoryUpdate && current_time >= JobHistoryUpdate) + cupsdCleanJobs(); + + /* + * Update any pending multi-file documents... + */ + + if ((current_time - senddoc_time) >= 10) + { + cupsdCheckJobs(); + senddoc_time = current_time; + } + /* * Check for new data on the client sockets... */ @@ -1024,23 +1041,6 @@ main(int argc, /* I - Number of command-line args */ } } - /* - * Update any pending multi-file documents... - */ - - if ((current_time - senddoc_time) >= 10) - { - cupsdCheckJobs(); - senddoc_time = current_time; - } - - /* - * Clean job history... - */ - - if (JobHistoryUpdate && current_time >= JobHistoryUpdate) - cupsdCleanJobs(); - /* * Log statistics at most once a minute when in debug mode... */ @@ -1711,12 +1711,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */ * Check for any job activity... */ - if (JobHistoryUpdate && timeout > JobHistoryUpdate) - { - timeout = JobHistoryUpdate; - why = "update job history"; - } - for (job = (cupsd_job_t *)cupsArrayFirst(ActiveJobs); job; job = (cupsd_job_t *)cupsArrayNext(ActiveJobs)) @@ -1747,22 +1741,6 @@ select_timeout(int fds) /* I - Number of descriptors returned */ } } - /* - * Check for temporary printers that need to be deleted... - */ - - for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers); printer; printer = (cupsd_printer_t *)cupsArrayNext(Printers)) - { - if (printer->temporary && !printer->job && (!local_timeout || local_timeout > (printer->state_time + 60))) - local_timeout = printer->state_time + 60; - } - - if (timeout > local_timeout && local_timeout) - { - timeout = local_timeout; - why = "delete stale local printers"; - } - /* * Adjust from absolute to relative time. We add 1 second to the timeout since * events occur after the timeout expires, and limit the timeout to 86400