]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Rework the idle exit fix after some discussion.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 21 Feb 2019 17:31:38 +0000 (12:31 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 21 Feb 2019 17:31:38 +0000 (12:31 -0500)
scheduler/main.c

index e96337086f405cf43995e1d1192aa0c7ebf577a1..588aadc85d74a8f8b8e148e662405fca3ce3c6c1 100644 (file)
@@ -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