Skip to content

Commit

Permalink
Close DB connections before running jobs.
Browse files Browse the repository at this point in the history
These connections will likely timeout anyway during something like
a commflagging or transcode job and if we exit the backend while
one of these jobs is running while we still have a DB connection
we don't get a clean exit.
  • Loading branch information
daniel-kristjansson committed Mar 15, 2012
1 parent be81782 commit 187e37d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mythtv/libs/libmythtv/jobqueue.cpp
Expand Up @@ -1987,6 +1987,7 @@ void JobQueue::DoTranscodeThread(int jobID)
LOG(VB_JOBQUEUE, LOG_INFO, LOC + QString("Running command: '%1'")
.arg(command));

GetMythDB()->GetDBManager()->CloseDatabases();
uint result = myth_system(command);
int status = GetJobStatus(jobID);

Expand Down Expand Up @@ -2160,6 +2161,7 @@ void JobQueue::DoMetadataLookupThread(int jobID)
LOG(VB_JOBQUEUE, LOG_INFO, LOC + QString("Running command: '%1'")
.arg(command));

GetMythDB()->GetDBManager()->CloseDatabases();
retVal = myth_system(command);
int priority = LOG_NOTICE;
QString comment;
Expand Down Expand Up @@ -2296,6 +2298,7 @@ void JobQueue::DoFlagCommercialsThread(int jobID)
LOG(VB_JOBQUEUE, LOG_INFO, LOC + QString("Running command: '%1'")
.arg(command));

GetMythDB()->GetDBManager()->CloseDatabases();
breaksFound = myth_system(command, kMSLowExitVal);
int priority = LOG_NOTICE;
QString comment;
Expand Down Expand Up @@ -2413,6 +2416,7 @@ void JobQueue::DoUserJobThread(int jobID)

LOG(VB_JOBQUEUE, LOG_INFO, LOC + QString("Running command: '%1'")
.arg(command));
GetMythDB()->GetDBManager()->CloseDatabases();
uint result = myth_system(command);

if ((result == GENERIC_EXIT_DAEMONIZING_ERROR) ||
Expand Down

0 comments on commit 187e37d

Please sign in to comment.