summaryrefslogtreecommitdiff
path: root/scheduler
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2019-02-21 12:31:10 -0500
committerMichael R Sweet <michael.r.sweet@gmail.com>2019-02-21 12:31:10 -0500
commit9bdea94b145114057c8016c3f182d758e576a9ff (patch)
tree8cd1978157f6a620942cc8bd44ee03cf4f20a800 /scheduler
parentb6787b69544676025153afec6c57e5afc3131cea (diff)
downloadcups-9bdea94b145114057c8016c3f182d758e576a9ff.tar.gz
Rework idle exit fix after some discussion.
Diffstat (limited to 'scheduler')
-rw-r--r--scheduler/main.c58
1 files 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 */
@@ -999,6 +999,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...
*/
@@ -1031,23 +1048,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))
@@ -1754,22 +1748,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
* seconds (1 day) to avoid select() timeout limits present on some operating