Skip to content

Commit

Permalink
Scheduler::FillRecordingDir: Fix a race condition trying to start a
Browse files Browse the repository at this point in the history
recording before being fulling initialized.

If a recording is 'in progress' when mythbackend starts up, it could fail to
record because the scheduler tries to start it up before it knows what
directory to store it in.
  • Loading branch information
jpoet committed Sep 23, 2016
1 parent 359a20a commit 96415b4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mythtv/programs/mythbackend/scheduler.cpp
Expand Up @@ -5048,6 +5048,14 @@ int Scheduler::FillRecordingDir(
{
LOG(VB_SCHEDULE, LOG_INFO, LOC + "FillRecordingDir: Starting");

uint cnt = 0;
while (!m_mainServer)
{
if (cnt++ % 20 == 0)
LOG(VB_SCHEDULE, LOG_WARNING, "Waiting for main server.");
usleep(50000);
}

int fsID = -1;
MSqlQuery query(MSqlQuery::InitCon());
QMap<QString, FileSystemInfo>::Iterator fsit;
Expand Down

0 comments on commit 96415b4

Please sign in to comment.