Variable refresh rate

Want something added? Ask for it here.
Post Reply
SABUser
Newbie
Newbie
Posts: 24
Joined: April 11th, 2008, 11:04 am

Variable refresh rate

Post by SABUser »

No idea if this is codable however.

When sab has something in its queue or is processing I manually set the refresh rate to 2 seconds.

However when sab is just sitting there I really don't need a 2 second refresh.

How about this:

When active refresh rate and when dormant refresh rate.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: Variable refresh rate

Post by shypike »

Difficult, if not impossible.
The refresh is triggered from the web-browser.
Suppose you have an empty queue and it's refreshing on an easy-going 1 minute basis.
If at some time queue is filled (through the blackhole), it still would take between
1 and 59 seconds to find out that the queue is no longer empty and the
rate should be adjusted.
Point is, we should redesign the web-interface to be a true Ajax implementation.
Work on this has begun, but will take quite some time.
onebinary
Release Testers
Release Testers
Posts: 28
Joined: May 30th, 2008, 4:08 am

Re: Variable refresh rate

Post by onebinary »

+1

I also found myself wanting this type of feature.  Also, I wouldn't mind a delay during the transitional periods (it would actually be expected with a standard meta refresh implementation).  I implemented this type of feature in my personal PHP front end for when I was using HellaNZB.  I think if it's understood that the refresh rate will not be instantly updated (much the same way the auto-pauser has a delay) then it may be worth slipping in this workaround until Ajax rules the world.
User avatar
mantis006
Release Testers
Release Testers
Posts: 17
Joined: January 28th, 2008, 5:06 am
Contact:

Re: Variable refresh rate [Edit 7/28/2008]

Post by mantis006 »

This would suck without some javascript at work to do the refreshing.  The Prototype JS libraries offer an Ajax.Updater described here: http://www.prototypejs.org/api/ajax/updater. 

To sum it up: ajax.updater Ajax.PreiodicalUpdater will subscribe to a served file, and if it changes, reset the download increments (say 2 seconds, whatever queue refresh is set to), or if it is the same, it will increase the time between requests.

I think plush is using jquery if i'm not mistaken; however most of these libraries offer similar features.  I've been curious as to what jquery supports so i'll look into in now...
Last edited by mantis006 on July 28th, 2008, 1:08 am, edited 1 time in total.
~Chris
User avatar
mantis006
Release Testers
Release Testers
Posts: 17
Joined: January 28th, 2008, 5:06 am
Contact:

Re: Variable refresh rate

Post by mantis006 »

I corrected my post above, the Prototype function is Ajax.PeriodicalUpdater() which takes a refresh delay and a decay value (decay is a multiplier for delay whenever the returned value is the same as last time).

I'm not finding anything too useful for jquery as I'm not so familiar with it.  googling "jquery periodicalupdater" returned a link to here: http://www.jasons-toolbox.com/JHeartbeat/ but that doesn't take a decay argument (like suggested in the OP).

Maybe a modification of something like: http://www.aspcode.net/Timed-Ajax-calls ... SPNET.aspx to be closer to this:

Code: Select all

<script  src="jquery.js"  type="text/javascript"></script> 
<script  type="text/javascript"> 
var delay = 3;  // start with a 3 second interval
var decay = 2; // everytime we query the same info, increase the decay by 2 fold
var c_delay = 1; // doesn't really matter, just setting to 1 incase i screwed something up
var previous = null;  // previous return data


$(document).ready(function()  { 
      setTimeout(MyUpdate,delay  *  1000); 
}); 
 
 
    
function  MyUpdate() 
{ 
     $.get("ajaxdata.ashx",function(result)    {
             var new_delay =  
             if (result == previous) {
                   // same data as last time, do nothing but increase our delay
                   c_delay = delay * decay;
             } else {
                  // {do work with result}
                  previous = result;
                  // reset delay
                  c_delay = delay;
            }
         }); 
     setTimeout(MyUpdate,c_delay  *  1000); 
  }
That should do about the same as PeriodicalUpdater I think, I haven't tested it; but, feel free to play around with it!

Enjoy
~Chris
Post Reply