PowerScheduler unconditionally checks every second (2 Viewers)

HTPCSourcer

Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,336
    Home Country
    Germany Germany
    AW: Re: PowerScheduler unconditionally checks every second

    I am inclined to agree.

    It might be of interest though to understand why the developer fixed this at 1 second. What would for example be the downside of having 60 sec intervals instead of 1 or 10 sec?
     

    Oxan

    Retired Team Member
  • Premium Supporter
  • August 29, 2009
    1,730
    1,124
    Home Country
    Netherlands Netherlands
    I've no clue. Anyway, the patch below against 1.2.x fixes it for me. I've attached a fixed version of PowerScheduler.dll for MP 1.2.2.

    Code:
    commit a9e50a7afe3d40fa2670c316d339ad5fd4f4a2de
    Author: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
    Date:   Tue Jan 3 23:10:30 2012
    
        PowerScheduler: Do not poll at one second intervals
        
        This is a totally unnecessary load on the system
    
    diff --git a/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs b/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs
    index 365337a..0fd79e5 100644
    --- a/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs
    +++ b/TvEngine3/TVLibrary/Plugins/PowerScheduler/PowerScheduler.cs
    @@ -825,32 +825,29 @@ namespace TvEngine.PowerScheduler
             Log.Error("Powerscheduler: Error naming thread - {0}", ex.Message);
           }
     
    -      int reload = 0;
    +      LogVerbose("Looping in intervals of {0} seconds", PowerSettings.CheckInterval);
    +
           do
           {
             if (!_standby)
             {
               try
               {
    -            if (reload++ == _reloadInterval)
    -            {
    -              reload = 0;
    -              CheckForStandby(true);
    -              // Clear cache
    -              CacheManager.Clear();
    -              GC.Collect();
    -              LoadSettings();
    -              SendPowerSchedulerEvent(PowerSchedulerEventType.Elapsed);
    -            }
    -            else
    -              CheckForStandby(false);
    +            CheckForStandby(true);
    +
    +            // Clear cache
    +            CacheManager.Clear();
    +            GC.Collect();
    +            LoadSettings();
    +
    +            SendPowerSchedulerEvent(PowerSchedulerEventType.Elapsed);
               }
               catch (Exception ex)
               {
                 Log.Write(ex);
               }
             }
    -        if (_stopThread.WaitOne(1000)) // Wait one sec / exit
    +        if (_stopThread.WaitOne(PowerSettings.CheckInterval * 1000)) // Wait one sec / exit
             {
               LogVerbose("Powerscheduler poll thread - exit");
               return;
     

    Attachments

    • Fixed PowerScheduler.zip
      74.2 KB

    HTPCSourcer

    Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,336
    Home Country
    Germany Germany
    AW: Re: PowerScheduler unconditionally checks every second

    I've no clue. Anyway, the patch below against 1.2.x fixes it for me. I've attached a fixed version of PowerScheduler.dll for MP 1.2.2.
    Thanks for the initiative, Oxan!

    I renamed my old powerscheduler.dll, saved the new one in the TV_Server plugin directory and then restarted the service (without going through the config though). When I launch MP the homescreen comes up, followed by a message window telling me that the connection with the TV Server was lost. Restoring the original version cures the issue.

    Have I done anything wrong?

    Regards, HTPC_Sourcer
     

    HTPCSourcer

    Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,336
    Home Country
    Germany Germany
    AW: Re: PowerScheduler unconditionally checks every second

    Well, what can I say. My setup reacts with "TVServer connection lost". It's a pity, I would have loved to test a less frequent polling.
     

    JBravo

    MP Donator
  • Premium Supporter
  • November 11, 2007
    269
    27
    Home Country
    Sweden Sweden
    Perhaps a stupid question, but did you stop/quit both client(s) and server before replacing the dll? I'm running a multi-seat setup here.
     

    HTPCSourcer

    Retired Team Member
  • Premium Supporter
  • May 16, 2008
    11,418
    2,336
    Home Country
    Germany Germany
    AW: Re: PowerScheduler unconditionally checks every second

    Perhaps a stupid question, but did you stop/quit both client(s) and server before replacing the dll? I'm running a multi-seat setup here.
    It's a single seat installation and I did restart the TV Server after replacing the dll. As far as I remember I din't stop it before but Windows did not complain when I renamed the file.

    Anyway, I'll give it another try and report back.

    Update: alright, this time I stopped the TV server prior to renaming the old dll. It works.
     

    mrmojo666

    MP Donator
  • Premium Supporter
  • January 24, 2006
    603
    182
    Turin
    Home Country
    Italy Italy
    Tank you your server patch works perfectly :)

    is this necessary to send keep server alive every second also for the client?

    Code:
    2012-02-13 21:38:57.322571 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:39:22.331001 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:39:47.337432 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:40:12.343862 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:40:37.351292 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:41:02.358723 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:41:27.363153 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:41:52.369583 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:42:17.377013 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:42:42.384444 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:43:07.390874 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:43:32.397304 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:43:57.436736 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:44:22.462168 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:44:47.466598 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:45:12.475028 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:45:37.530461 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:46:02.534892 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:46:27.542322 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:46:52.549752 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:47:17.601185 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:47:42.610616 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:48:07.647048 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:48:32.653478 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:48:57.660908 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:49:22.667339 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 21:49:47.673769 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:50:12.681199 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:50:37.687629 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 21:51:02.695060 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:51:27.702490 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:51:52.710921 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 21:52:17.718351 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:52:42.723781 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:53:07.731211 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 21:53:32.739642 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:53:57.745072 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:54:22.751502 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 21:54:47.758933 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 21:55:12.767363 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:55:37.772793 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:56:02.780224 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:56:27.787654 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:56:52.794084 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:57:17.798514 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 21:57:42.809945 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:58:07.813375 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:58:32.852807 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 21:58:57.860238 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 21:59:22.867668 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 21:59:47.872098 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 22:00:12.881529 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:00:37.886959 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 22:01:02.893389 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:01:27.899819 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:01:52.907250 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 22:02:17.914680 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 22:02:42.921110 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 22:03:07.930541 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:03:32.935971 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:03:57.943401 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:04:22.950832 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 22:04:47.957262 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:05:12.963692 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 22:05:37.971123 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 22:06:02.978553 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:06:27.984983 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:06:52.992414 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:07:17.998844 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:07:43.006274 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:08:08.012705 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:08:33.020135 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 22:08:58.028565 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:09:23.033996 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:09:48.041426 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:10:13.049856 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 22:10:38.055287 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:11:03.059717 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:11:28.067147 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:11:53.074577 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:12:18.081008 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 22:12:43.088438 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:13:08.095868 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:13:33.102299 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:13:58.109729 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:14:23.116159 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:14:48.124590 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:15:13.132020 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:15:38.137450 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:16:03.147881 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:16:28.153311 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:16:53.158741 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:17:18.166172 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:17:43.173602 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:18:08.180032 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:18:33.277468 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:18:58.286898 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:19:23.293328 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:19:48.300759 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 22:20:13.307189 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:20:38.315619 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:21:03.322050 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:21:28.329480 [Info.][(6)]: PowerScheduler: Keep server alive
    2012-02-13 22:21:53.335910 [Info.][(23)]: PowerScheduler: Keep server alive
    2012-02-13 22:22:18.343341 [Info.][(9)]: PowerScheduler: Keep server alive
    2012-02-13 22:22:43.349771 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:23:08.357201 [Info.][(33)]: PowerScheduler: Keep server alive
    2012-02-13 22:23:33.363632 [Info.][(10)]: PowerScheduler: Keep server alive
    2012-02-13 22:23:58.371062 [Info.][(33)]: PowerScheduler: Keep server alive
     

    JBravo

    MP Donator
  • Premium Supporter
  • November 11, 2007
    269
    27
    Home Country
    Sweden Sweden
    The message above is sent every 25s, this to inform the TV server that there are active clients. I think this was done in the "normal" loop for the PS Client Plugin.
     

    Users who are viewing this thread

    Top Bottom