[mythtv] [PATCH] Stop automatic shutdown when jobs still pending (or user jobs running)

Matt Doran matt.doran at papercut.biz
Tue Apr 24 13:08:07 UTC 2007

Hi all,

This is my first patch to myth, so be gentle.   :)     The issue that 
this patch solves is discussed in the thread: "Auto shutdown occurs 
while transcode/commflag job is in progress (bad idle detection)"

The problem is that the way that the idle detection and shutdown works, 
it is likely/common that the the machine will automatically shutdown 
between one transcode/commflag job completing and the next one 
starting.  The solution is to also check to see if there are jobs 
pending before shutting down. 

Chris Pinkham suggested an approach for the patch, and I've developed it. 

Here's the log for the patch:

    * JobQueue: Add new method HasRunningOrPendingJobs() to see if there
      are running or pending jobs in the queue.  The optional
      checkWindow parameter determined if we consider the job run window
      when checking for pending jobs.  Another advantage is that we now
      won't shutdown when user jobs are running.
    * mythshutdown: in the status checks call the
      "HasRunningOrPendingJobs()" to see if there are jobs running or
      pending.  The status of 32 indicates if there are jobs running or
    * mythwelcome: display a message when the new status is found.

I have a couple of questions:

   1. In mythwelcome, the new string was surrounded in tr(), which I
      assume is for translation.  Is there any more I need to do?
   2. Chris recently added a schedruntime field to schedule jobs in the
      future.  I don't currently look at this, but probably should.  If
      the job is set in the future, I should not consider this job
      pending. i.e. schedruntime > current-time, then ignore it.  Is
      that right?
   3. In mythshutdown, my new check is in addition to the existing
      transcode and commflag test.  In this patch I only do the new
      check if there is no other activity stopping a shutdown.  This is
      to stop mythwelcome showing two status strings.  e.g. "busy
      transcoding" and "has running or pending jobs".   Is this OK? 
      What do you think is the best approach here?   If a transcode or
      commflag is running, then this new check doesn't do anything new. 
      If these aren't running, the new check can pickup jobs about to
      start ... or running user jobs.

Any feedback is appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mythtv.org/pipermail/mythtv-dev/attachments/20070424/ca28597f/attachment.htm 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: shutdown-jobs.diff
Url: http://mythtv.org/pipermail/mythtv-dev/attachments/20070424/ca28597f/attachment.diff 

More information about the mythtv-dev mailing list