Ticket #2194: housekeeper.2.diff
File housekeeper.2.diff, 1.8 KB (added by , 17 years ago) |
---|
-
mythtv/programs/mythbackend/housekeeper.cpp
50 50 unsigned int longEnough = 0; 51 51 52 52 if (period) 53 longEnough = ((period * oneday) - 600);53 longEnough = ((period * oneday) - oneday/2); 54 54 else 55 55 longEnough = oneday / 8; 56 56 … … 58 58 QDateTime lastrun; 59 59 lastrun.setTime_t(0); 60 60 61 if (minhour < 0) 62 minhour = 0; 63 if (maxhour > 23) 64 maxhour = 23; 65 if (minhour > maxhour) 66 { 67 VERBOSE(VB_GENERAL, 68 "Housekeeping thread will not run: supplied time range is empty"); 69 } 70 61 71 MSqlQuery result(MSqlQuery::InitCon()); 62 72 if (result.isConnected()) 63 73 { … … 69 79 result.next(); 70 80 lastrun = result.value(0).toDateTime(); 71 81 72 if ((now.toTime_t() - lastrun.toTime_t()) > longEnough) 82 if ((now.toTime_t() - lastrun.toTime_t()) > longEnough && 83 (now.toString(QString("d")).toInt() != 84 lastrun.toString(QString("d")).toInt())) 73 85 { 74 86 int hour = now.toString(QString("h")).toInt(); 75 87 if ((hour >= minhour) && (hour <= maxhour)) 76 runOK = true; 88 { 89 int minute = now.toString(QString("m")).toInt(); 90 if ((hour == maxhour && minute > 30) || 91 ((random()%((maxhour-hour)*12+(60-minute)/5 - 6) == 0))) 92 runOK = true; 93 } 77 94 } 78 95 } 79 96 else … … 239 256 updateLastrun(dbTag); 240 257 } 241 258 242 sleep(300 );259 sleep(300 + (random()%8)); 243 260 } 244 261 } 245 262