diff -up mythtv-0.21/programs/mythbackend/housekeeper.h.mythfilldatabase-check-at-startup mythtv-0.21/programs/mythbackend/housekeeper.h
old
|
new
|
class HouseKeeper |
27 | 27 | |
28 | 28 | private: |
29 | 29 | |
30 | | bool wantToRun(const QString &dbTag, int period, int minhour, int maxhour); |
| 30 | bool wantToRun(const QString &dbTag, int period, int minhour, int maxhour, bool exact = false); |
31 | 31 | void updateLastrun(const QString &dbTag); |
32 | 32 | QDateTime getLastRun(const QString &dbTag); |
33 | 33 | void flushLogs(); |
diff -up mythtv-0.21/programs/mythbackend/housekeeper.cpp.mythfilldatabase-check-at-startup mythtv-0.21/programs/mythbackend/housekeeper.cpp
old
|
new
|
HouseKeeper::~HouseKeeper() |
47 | 47 | } |
48 | 48 | |
49 | 49 | bool HouseKeeper::wantToRun(const QString &dbTag, int period, int minhour, |
50 | | int maxhour) |
| 50 | int maxhour, bool exact) |
51 | 51 | { |
52 | 52 | bool runOK = false; |
53 | 53 | unsigned int oneday = 60 * 60 * 24; |
… |
… |
bool HouseKeeper::wantToRun(const QStrin |
88 | 88 | ((hour >= minhour) && (hour <= maxhour))) |
89 | 89 | { |
90 | 90 | int minute = now.time().minute(); |
91 | | if ((hour == maxhour && minute > 30) || |
| 91 | if (exact || |
| 92 | (hour == maxhour && minute > 30) || |
92 | 93 | ((random()%(((maxhour-hour)*12+(60-minute)/5 - 6) + 1)) == 0)) |
93 | 94 | runOK = true; |
94 | 95 | } |
… |
… |
void HouseKeeper::RunHouseKeeping(void) |
147 | 148 | { |
148 | 149 | int period, maxhr, minhr; |
149 | 150 | QString dbTag; |
| 151 | bool initial = true; |
| 152 | |
150 | 153 | // wait a little for main server to come up and things to settle down |
151 | 154 | sleep(10); |
152 | 155 | |
… |
… |
void HouseKeeper::RunHouseKeeping(void) |
226 | 229 | (lastRun.secsTo(now) > (3 * 60 * 60))) |
227 | 230 | runMythFill = true; |
228 | 231 | } |
229 | | else if (wantToRun("MythFillDB", period, minhr, maxhr)) |
| 232 | else if (wantToRun("MythFillDB", period, minhr, maxhr, initial)) |
230 | 233 | { |
231 | 234 | runMythFill = true; |
232 | 235 | } |
… |
… |
void HouseKeeper::RunHouseKeeping(void) |
259 | 262 | updateLastrun(dbTag); |
260 | 263 | } |
261 | 264 | |
| 265 | // Initial housekeeping run completed |
| 266 | initial = false; |
| 267 | |
262 | 268 | sleep(300 + (random()%8)); |
263 | 269 | } |
264 | 270 | } |