NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 55 56 57 58 59 … 93 Next »
ScheduleHelper.LoadRecordingSchedule() and SQLite database locks

 
  • 0 Vote(s) - 0 Average
ScheduleHelper.LoadRecordingSchedule() and SQLite database locks
alibert
Offline

Posting Freak

Posts: 974
Threads: 83
Joined: Apr 2005
#1
2006-05-23, 05:36 PM
Hi,

Maybe something for the wishlist, but I'll write it down here.

It seems that "LoadRecordingSchedule()" always reads out the recordings from the database when called by the schedule helper instance.

Would it be possible to provide the list as a readonly property, and the list is always kept up to date (so that it actually synchronizes with the database only when it has to)?

I'm asking this because sqlite locks the whole database during a transaction, and the only workaround is to try it again some time later in a Thread.Sleep-loop. And there is no other possibility to get an updated list except calling the LoadRecordingSchedule()-method, even if it was called directly before.

I'll attach some code because I think that it's not that easy to explain, and the code should make clear what I mean.

Code:
private static void ThreadProc()
{
    // don't disturb
    databaseWatcher.EnableRaisingEvents = false;

    // wait a bit until the transaction is hopefully completed
    Thread.Sleep(200);
  
    IList updatedList = null;
    while (null == updatedList)
    {
        try
        {
            // load schedule from database
            updatedList = ScheduleHelper.getInstance().LoadRecordingSchedule();
        }
        catch (Exception ex)
        {
            updatedList = null;
            Logger.Verbose("Thread: " + ex.Message);
            Thread.Sleep(200);
        }
    }

    // new list
    recordingSchedule = updatedList;

    // update states as well
    lock (states)
    {
        states.Clear();
        foreach (ScheduledRecording scheduledRecording in recordingSchedule)
        {
            if (ScheduledRecording.STATUS_DELETED != scheduledRecording.getRecordingStatus() &&
                ScheduledRecording.STATUS_PLACE_HOLDER != scheduledRecording.getRecordingStatus())
            {
                states[scheduledRecording.getProgramme().getOID()] = scheduledRecording.getRecordingStatus();
            }
        }
    }   // lock

    MyGuide.NeedRendering = true;
    databaseWatcher.EnableRaisingEvents = true;
}

-alibert
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Delete recordings from database but not from disk? spinnaker 8 3,748 2013-10-26, 10:51 PM
Last Post: spinnaker
  trying to fake npvr database for unit tests reven 3 2,237 2013-05-20, 08:53 AM
Last Post: reven
  Merged database queries mvallevand 4 2,051 2011-06-26, 09:56 PM
Last Post: mvallevand
  NPVR database questions mvallevand 25 9,777 2011-01-06, 12:58 AM
Last Post: jksmurf
  NPVR database - why so stringy with the fields?? :0) carpeVideo 4 1,986 2010-09-21, 01:48 AM
Last Post: sub
  NPVR Database connection ralphy 4 2,428 2010-09-15, 12:09 AM
Last Post: sub
  How can I reset the Music plugin's database? mkenyon2 1 1,881 2009-10-15, 06:43 PM
Last Post: psycik
  ScheduleHelper.SheduleRecording returns Nothing MaidenQuebec 7 2,984 2009-03-20, 12:21 PM
Last Post: Ernie-c
  SheduleRecording() locks database cb123 3 2,474 2009-02-14, 06:33 PM
Last Post: sub
  GB-PVR rec. service locks my classlib bgowland 6 2,551 2009-02-12, 11:32 PM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode