]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler (incorrectly) woke up once per second to remove stale temporary
authorMichael Sweet <michael.r.sweet@gmail.com>
Mon, 11 Sep 2017 21:08:17 +0000 (17:08 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Mon, 11 Sep 2017 21:08:17 +0000 (17:08 -0400)
queues (Issue #5100).

- scheduler/main.c: Update local_timeout to start at 0 and only get updated as
  needed.

Fixes: #5100
CHANGES.md
scheduler/main.c

index f5f09c7b350353eb2d5f473c521fea73b4be8f4b..d79faa8b1164ad2df8c9dc90e190924a6f9ca028 100644 (file)
@@ -37,6 +37,8 @@ CHANGES IN CUPS V2.2.5
   choosing them for draft, normal, and best quality modes (Issue #5091)
 - Fixed the localization unit test on Linux (Issue #5097)
 - The CUPS library did not reuse domain sockets (Issue #5098)
+- The scheduler woke up once per second to remove old temporary queues
+  (Issue #5100)
 - Added USB quirk rule for Kyocera printer (Issue #5102, Issue #5103)
 - `httpAddrConnect` leaked sockets in certain circumstances, causing some
   printers to hang (rdar://31965686)
index c13d64520e6f1374cafdd2081bc30fae81c826e3..09735b83aceafcfe6722417de616d45af0e90b53 100644 (file)
@@ -696,7 +696,7 @@ main(int  argc,                             /* I - Number of command-line args */
   current_time  = time(NULL);
   event_time    = current_time;
   expire_time   = current_time;
-  local_timeout = current_time + 60;
+  local_timeout = 0;
   fds           = 1;
   report_time   = 0;
   senddoc_time  = current_time;
@@ -958,7 +958,10 @@ main(int  argc,                            /* I - Number of command-line args */
     */
 
     if (current_time >= local_timeout)
+    {
       cupsdDeleteTemporaryPrinters(0);
+      local_timeout = 0;
+    }
 
 #ifndef HAVE_AUTHORIZATION_H
    /*
@@ -1732,11 +1735,11 @@ select_timeout(int fds)                 /* I - Number of descriptors returned */
 
   for (printer = (cupsd_printer_t *)cupsArrayFirst(Printers); printer; printer = (cupsd_printer_t *)cupsArrayNext(Printers))
   {
-    if (printer->temporary && !printer->job && local_timeout > (printer->state_time + 60))
+    if (printer->temporary && !printer->job && (!local_timeout || local_timeout > (printer->state_time + 60)))
       local_timeout = printer->state_time + 60;
   }
 
-  if (timeout > local_timeout)
+  if (timeout > local_timeout && local_timeout)
   {
     timeout = local_timeout;
     why     = "delete stale local printers";