]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
scheduler/printers.c: Don't remove processing temp queue 364/head
authorZdenek Dohnal <zdohnal@redhat.com>
Wed, 6 Apr 2022 09:18:11 +0000 (11:18 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Wed, 6 Apr 2022 09:18:11 +0000 (11:18 +0200)
cupsdDeleteTemporaryPrinters() deletes temporary queues which their last
status was updated 1 minute ago or older. It doesn't take into account
the fact the printer can be processing a big print job and cupsd deletes
the temp queue either way.

The fix in the PR now set cupsd to ignore queues which are in processing
state. If the delay in job processing is caused by an error in printer,
the correct error should kick in IPP backend.

scheduler/printers.c

index fffb4e7b832e8b7db7e6ac2733e7a611ccac51c2..7a5791ba1e732b5b2b74c0433046c96ff81afe55 100644 (file)
@@ -883,6 +883,9 @@ cupsdDeleteTemporaryPrinters(int force) /* I - Force deletion instead of auto? *
   time_t          unused_time;          /* Last time for printer state change */
 
 
+  cupsdLogMessage(CUPSD_LOG_DEBUG2,
+                 "cupsdDeleteTemporaryPrinters: Removing unused temporary printers");
+
  /*
   * Allow temporary printers to stick around for 60 seconds after the last job
   * completes.
@@ -892,7 +895,8 @@ cupsdDeleteTemporaryPrinters(int force) /* I - Force deletion instead of auto? *
 
   for (p = (cupsd_printer_t *)cupsArrayFirst(Printers); p; p = (cupsd_printer_t *)cupsArrayNext(Printers))
   {
-    if (p->temporary && (force || p->state_time < unused_time))
+    if (p->temporary &&
+       (force || (p->state_time < unused_time && p->state != IPP_PSTATE_PROCESSING)))
       cupsdDeletePrinter(p, 0);
   }
 }