summaryrefslogtreecommitdiff
path: root/scheduler
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2019-02-21 11:03:50 -0500
committerMichael R Sweet <michael.r.sweet@gmail.com>2019-02-21 11:03:50 -0500
commit47b3bd03e4bbacf355ccdadce4b0331e6944f140 (patch)
treefff43d92398c622471a8c2a057005c4e103ad244 /scheduler
parent45cae1bc04117750d9a8b4722c257eeebc784cc7 (diff)
downloadcups-47b3bd03e4bbacf355ccdadce4b0331e6944f140.tar.gz
The scheduler did not always idle exit as quickly as it could...
Diffstat (limited to 'scheduler')
-rw-r--r--scheduler/main.c7
-rw-r--r--scheduler/server.c11
-rw-r--r--scheduler/subscriptions.c5
3 files changed, 17 insertions, 6 deletions
diff --git a/scheduler/main.c b/scheduler/main.c
index 3b258a70a..276a36a82 100644
--- a/scheduler/main.c
+++ b/scheduler/main.c
@@ -1,7 +1,7 @@
/*
* Main loop for the CUPS scheduler.
*
- * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
@@ -813,7 +813,7 @@ main(int argc, /* I - Number of command-line args */
* inactivity...
*/
- if (timeout == 86400 && OnDemand && IdleExitTimeout &&
+ if (OnDemand && IdleExitTimeout &&
# ifdef HAVE_SYSTEMD
!WebInterface &&
# endif /* HAVE_SYSTEMD */
@@ -963,8 +963,7 @@ main(int argc, /* I - Number of command-line args */
if (current_time > expire_time)
{
- if (cupsArrayCount(Subscriptions) > 0)
- cupsdExpireSubscriptions(NULL, NULL);
+ cupsdExpireSubscriptions(NULL, NULL);
cupsdUnloadCompletedJobs();
diff --git a/scheduler/server.c b/scheduler/server.c
index a4033791b..bb646d813 100644
--- a/scheduler/server.c
+++ b/scheduler/server.c
@@ -1,7 +1,7 @@
/*
* Server start/stop routines for the CUPS scheduler.
*
- * Copyright 2007-2017 by Apple Inc.
+ * Copyright 2007-2019 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
@@ -173,6 +173,15 @@ cupsdStopServer(void)
DefaultProfile = NULL;
/*
+ * Expire subscriptions and clean out old jobs...
+ */
+
+ cupsdExpireSubscriptions(NULL, NULL);
+
+ if (JobHistoryUpdate)
+ cupsdCleanJobs();
+
+ /*
* Write out any dirty files...
*/
diff --git a/scheduler/subscriptions.c b/scheduler/subscriptions.c
index 36bf29ceb..0908f3c0c 100644
--- a/scheduler/subscriptions.c
+++ b/scheduler/subscriptions.c
@@ -1,7 +1,7 @@
/*
* Subscription routines for the CUPS scheduler.
*
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2019 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more information.
@@ -648,6 +648,9 @@ cupsdExpireSubscriptions(
time_t curtime; /* Current time */
+ if (cupsArrayCount(Subscriptions) == 0)
+ return;
+
curtime = time(NULL);
update = 0;