Skip to content

Commit

Permalink
Do not allow EIT to prevent backend shutdown through last minute resc…
Browse files Browse the repository at this point in the history
…hedules. Closes #3597

Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information
Andrew M. Bishop authored and stuartm committed Jul 24, 2011
1 parent ce71c14 commit de0d29c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 12 additions & 8 deletions mythtv/programs/mythbackend/scheduler.cpp
Expand Up @@ -1914,7 +1914,8 @@ void Scheduler::run(void)
if ((idleTimeoutSecs > 0) && (m_mainServer != NULL))
{
HandleIdleShutdown(blockShutdown, idleSince, prerollseconds,
idleTimeoutSecs, idleWaitForRecordingTime);
idleTimeoutSecs, idleWaitForRecordingTime,
statuschanged);
}
}

Expand Down Expand Up @@ -2511,7 +2512,8 @@ void Scheduler::HandleTuning(RecordingInfo &ri, bool &statuschanged)

void Scheduler::HandleIdleShutdown(
bool &blockShutdown, QDateTime &idleSince,
int prerollseconds, int idleTimeoutSecs, int idleWaitForRecordingTime)
int prerollseconds, int idleTimeoutSecs, int idleWaitForRecordingTime,
bool &statuschanged)
{
if ((idleTimeoutSecs <= 0) || (m_mainServer == NULL))
return;
Expand Down Expand Up @@ -2545,8 +2547,11 @@ void Scheduler::HandleIdleShutdown(
}
resetIdleTime_lock.unlock();

if (!idleSince.isValid())
if (statuschanged || !idleSince.isValid())
{
if (!idleSince.isValid())
idleSince = curtime;

RecIter idleIter = reclist.begin();
for ( ; idleIter != reclist.end(); ++idleIter)
if ((*idleIter)->GetRecordingStatus() ==
Expand All @@ -2557,17 +2562,16 @@ void Scheduler::HandleIdleShutdown(
{
if (curtime.secsTo
((*idleIter)->GetRecordingStartTime()) -
prerollseconds >
prerollseconds <
(idleWaitForRecordingTime * 60) +
idleTimeoutSecs)
{
idleSince = curtime;
idleSince = QDateTime();
}
}
else
idleSince = curtime;
}
else

if (idleSince.isValid())
{
// is the machine already idling the timeout time?
if (idleSince.addSecs(idleTimeoutSecs) < curtime)
Expand Down
3 changes: 2 additions & 1 deletion mythtv/programs/mythbackend/scheduler.h
Expand Up @@ -165,7 +165,8 @@ class Scheduler : public QThread
RecordingInfo &ri, RecStatusTypes recStatus, const QString &details);
void HandleIdleShutdown(
bool &blockShutdown, QDateTime &idleSince, int prerollseconds,
int idleTimeoutSecs, int idleWaitForRecordingTime);
int idleTimeoutSecs, int idleWaitForRecordingTime,
bool &statuschanged);


MythDeque<int> reschedQueue;
Expand Down

0 comments on commit de0d29c

Please sign in to comment.