[mythtv] Auto shutdown occurs while transcode/commflag job is in progress (bad idle detection)

Chris Pinkham cpinkham at bc2va.org
Mon Apr 16 00:55:13 UTC 2007

* On Mon Apr 16, 2007 at 09:57:02AM +1000, Matt Doran wrote:
> >     * Make CheckShutdownServer() or whatever code actually gets executed
> >       check for pending jobs in the JobQueue.

> If I were to develop a patch for this, how does this sound:
>     * Add a new test to GetStatus() to check for pending jobs (if not in
>       the job window, we treat it like no jobs are pending)
>     * Return status "32" (currently not used) to indicate there are jobs
>       pending.

Sounds OK to me, but I'm not the mythshutdown guy (I'm the JobQueue guy).

If you make a patch, can you put the logic inside a new method inside the
JobQueue class?

I'm thinking something like this:

	static bool JobQueue::HasPendingJobs(bool checkWindow = true)

If HasPendingJobs is static then you can just call it as
"if (JobQueue::HasPendingJobs())" inside the status check code.

If we call it as JobQueue::HasPendingJobs(false) then it can tell us if
there are any pending jobs at all, whether we are inside the window or not.

You probably should make it so that the window check checks to see if the
window is about to start also, because there's no reason to shutdown if the
window starts in 15 minutes and we could process the jobs.

You can look at JobQueue::IsJobQueuedOrRunning() to see what I use to check
to see if a specific job is queued or running.


More information about the mythtv-dev mailing list