Ticket #2194: randomfill.patch

File randomfill.patch, 1.1 KB (added by willu.mailingLists@…, 19 years ago)

patch to randomise mythfilldatabase download times

  • programs/mythbackend/housekeeper.cpp

     
    4848    unsigned int longEnough = 0;
    4949
    5050    if (period)
    51         longEnough = ((period * oneday) - 600);
     51        longEnough = ((period * oneday) - oneday/2);
    5252    else
    5353        longEnough = oneday / 8;
    5454
     
    7171            {
    7272                int hour = now.toString(QString("h")).toInt();
    7373                if ((hour >= minhour) && (hour <= maxhour))
    74                     runOK = true;
     74                {
     75                    int minute = now.toString(QString("m")).toInt();
     76                    if ((hour == maxhour && minute > 30)
     77                            || ((random()%((maxhour-minhour+1)*6)) == 0))
     78                        runOK = true;
     79                }
    7580            }
    7681        }
    7782        else
     
    241246            updateLastrun(dbTag);
    242247        }
    243248
    244         sleep(300);
     249        sleep(300 + (random()%8));
    245250    }
    246251}
    247252