Skip to content

Commit

Permalink
Convert HardwareProfile task to a periodic task.
Browse files Browse the repository at this point in the history
This converts the HardwareProfileTask housekeeper task to a periodic
task, meaning there is some fuzzing on when the script will next be run,
rather than the next housekeeping pass after thirty days.
  • Loading branch information
wagnerrp committed Jun 9, 2013
1 parent c29c40d commit ccc7dab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions mythtv/libs/libmythbase/hardwareprofile.cpp
Expand Up @@ -288,10 +288,12 @@ QString HardwareProfile::GetHardwareProfile() const

bool HardwareProfileTask::DoCheckRun(QDateTime now)
{
if (GetLastRun().secsTo(now) > 2592000 && // 60*60*24*30
(gCoreContext->GetNumSetting("HardwareProfileEnabled", 0) == 1))
return true;
return false;
if (gCoreContext->GetNumSetting("HardwareProfileEnabled", 0) == 0)
// global disable, we don't want to run
return false;

// leave it up to the standard periodic calculation, 30 +-1 days
return PeriodicHouseKeeperTask::DoCheckRun(now);
}

bool HardwareProfileTask::DoRun(void)
Expand Down
7 changes: 5 additions & 2 deletions mythtv/libs/libmythbase/hardwareprofile.h
Expand Up @@ -49,10 +49,13 @@ class MBASE_PUBLIC HardwareProfile : public QObject
QString m_hardwareProfile;
};

class MBASE_PUBLIC HardwareProfileTask : public HouseKeeperTask
class MBASE_PUBLIC HardwareProfileTask : public PeriodicHouseKeeperTask
{
public:
HardwareProfileTask(void) : HouseKeeperTask("HardwareProfiler",
HardwareProfileTask(void) : PeriodicHouseKeeperTask("HardwareProfiler",
2592000, // 30 days in seconds
0.96667, // up to one day early
1.03333, // up to one day late
kHKLocal, kHKRunOnStartup) {}
virtual bool DoCheckRun(QDateTime now);
virtual bool DoRun(void);
Expand Down

0 comments on commit ccc7dab

Please sign in to comment.