From 9bdea94b145114057c8016c3f182d758e576a9ff Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 21 Feb 2019 12:31:10 -0500 Subject: [PATCH] Rework idle exit fix after some discussion. --- scheduler/main.c | 58 +++++++++++++++--------------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/scheduler/main.c b/scheduler/main.c index 276a36a82..22372d4f1 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -813,7 +813,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 */ @@ -998,6 +998,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... */ @@ -1030,23 +1047,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... */ @@ -1717,12 +1717,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)) @@ -1753,22 +1747,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 -- 2.39.2