Ticket #4961: mythtv-0.21-mythfilldatabase-check-at-startup.patch

File mythtv-0.21-mythfilldatabase-check-at-startup.patch, 2.7 KB (added by stefan.becker@…, 12 years ago)

Add "exact" parameter to wantToRun(); Use exact==true for mythfilldatabase in the first housekeeping run

  • mythtv-0.21/programs/mythbackend/housekeeper.h

    diff -up mythtv-0.21/programs/mythbackend/housekeeper.h.mythfilldatabase-check-at-startup mythtv-0.21/programs/mythbackend/housekeeper.h
    old new class HouseKeeper 
    2727
    2828  private:
    2929
    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);
    3131    void updateLastrun(const QString &dbTag);
    3232    QDateTime getLastRun(const QString &dbTag);
    3333    void flushLogs();
  • mythtv-0.21/programs/mythbackend/housekeeper.cpp

    diff -up mythtv-0.21/programs/mythbackend/housekeeper.cpp.mythfilldatabase-check-at-startup mythtv-0.21/programs/mythbackend/housekeeper.cpp
    old new HouseKeeper::~HouseKeeper() 
    4747}
    4848
    4949bool HouseKeeper::wantToRun(const QString &dbTag, int period, int minhour,
    50                             int maxhour)
     50                            int maxhour, bool exact)
    5151{
    5252    bool runOK = false;
    5353    unsigned int oneday = 60 * 60 * 24;
    bool HouseKeeper::wantToRun(const QStrin 
    8888                    ((hour >= minhour) && (hour <= maxhour)))
    8989                {
    9090                    int minute = now.time().minute();
    91                     if ((hour == maxhour && minute > 30) ||
     91                    if (exact ||
     92                        (hour == maxhour && minute > 30) ||
    9293                        ((random()%(((maxhour-hour)*12+(60-minute)/5 - 6) + 1)) == 0))
    9394                        runOK = true;
    9495                }
    void HouseKeeper::RunHouseKeeping(void) 
    147148{
    148149    int period, maxhr, minhr;
    149150    QString dbTag;
     151    bool initial = true;
     152
    150153    // wait a little for main server to come up and things to settle down
    151154    sleep(10);
    152155
    void HouseKeeper::RunHouseKeeping(void) 
    226229                            (lastRun.secsTo(now) > (3 * 60 * 60)))
    227230                            runMythFill = true;
    228231                    }
    229                     else if (wantToRun("MythFillDB", period, minhr, maxhr))
     232                    else if (wantToRun("MythFillDB", period, minhr, maxhr, initial))
    230233                    {
    231234                        runMythFill = true;
    232235                    }
    void HouseKeeper::RunHouseKeeping(void) 
    259262            updateLastrun(dbTag);
    260263        }
    261264
     265        // Initial housekeeping run completed
     266        initial = false;
     267
    262268        sleep(300 + (random()%8));
    263269    }
    264270}