diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-18 01:34:03 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-06-18 01:34:03 +0100 |
commit | 17824b65d0dbf640f23507f1f983acfc4177da94 (patch) | |
tree | 7252c54fe8f58d84969efff6920501d2229be3be | |
parent | Merge branch 'p2pvr' (diff) | |
download | p2pvr-17824b65d0dbf640f23507f1f983acfc4177da94.tar.bz2 p2pvr-17824b65d0dbf640f23507f1f983acfc4177da94.tar.xz p2pvr-17824b65d0dbf640f23507f1f983acfc4177da94.zip |
Add an option to force performing a maintenance cycle on start-up
-rw-r--r-- | p2pvr/daemon/maintenance.cpp | 11 | ||||
-rw-r--r-- | p2pvr/daemon/maintenance.h | 1 |
2 files changed, 8 insertions, 4 deletions
diff --git a/p2pvr/daemon/maintenance.cpp b/p2pvr/daemon/maintenance.cpp index 928e8d9..e3747b3 100644 --- a/p2pvr/daemon/maintenance.cpp +++ b/p2pvr/daemon/maintenance.cpp @@ -10,6 +10,7 @@ time_t Maintenance::periodUpdateNetwork; time_t Maintenance::periodUpdateServices; time_t Maintenance::periodUpdateEvents; +bool Maintenance::scanOnStart; DECLARE_OPTIONS(Maintenance, "P2PVR Maintenance options") ("p2pvr.maintenance.periodUpdateNetwork", Options::value(&periodUpdateNetwork, 86400 * 7), @@ -18,12 +19,14 @@ DECLARE_OPTIONS(Maintenance, "P2PVR Maintenance options") "Period between automated updates of DVB services (1 week)") ("p2pvr.maintenance.periodUpdateEvents", Options::value(&periodUpdateEvents, 3600 * 12), "Period between automated updates of DVB events (12 hours)") +("p2pvr.maintenance.scanOnStart", Options::value(&scanOnStart, false), + "Perform the maintenance circle on start-up (false)") END_OPTIONS(Maintenance); Maintenance::Maintenance(Ice::ObjectAdapterPtr a, IceUtil::TimerPtr t) : adapter(a), timer(t), - clientCheck(new BindTimerTask(boost::bind(&Maintenance::ScheduledUpdate, this))), + clientCheck(new BindTimerTask(boost::bind(&Maintenance::ScheduledUpdate, this))), lastUpdateNetwork(0), lastUpdateServices(0), lastUpdateEvents(0), @@ -32,9 +35,9 @@ Maintenance::Maintenance(Ice::ObjectAdapterPtr a, IceUtil::TimerPtr t) : if (timer) { timer->scheduleRepeated(clientCheck, IceUtil::Time::seconds(5 * 60)); } -#ifdef NDEBUG - ScheduledUpdate(); -#endif + if (scanOnStart) { + ScheduledUpdate(); + } } void diff --git a/p2pvr/daemon/maintenance.h b/p2pvr/daemon/maintenance.h index 5b663eb..7ec0541 100644 --- a/p2pvr/daemon/maintenance.h +++ b/p2pvr/daemon/maintenance.h @@ -31,6 +31,7 @@ class Maintenance : public P2PVR::Maintenance, public DatabaseClient { static time_t periodUpdateNetwork; static time_t periodUpdateServices; static time_t periodUpdateEvents; + static bool scanOnStart; }; #endif |