Skip to content

Commit

Permalink
Add the refresh rate to the server time to make endpoints even more t…
Browse files Browse the repository at this point in the history
…imely
  • Loading branch information
John P. Bloch committed May 7, 2014
1 parent 11a8aa1 commit 548b005
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions live-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
var date = resp.getResponseHeader('Date'),
serverTime = Math.round((new Date(date)).getTime() / 1000);

// look only at the tens place of the second counter to refresh cache every ten seconds.
timeStamp = formatTimestampEndpoint(int_to_timestamp(serverTime));

data.refresh_rate = getRefreshRate(data.refresh_rate || 0);

// look only at the tens place of the second counter to refresh cache every ten seconds.
timeStamp = formatTimestampEndpoint(int_to_timestamp(serverTime + data.refresh_rate));

$.each(data, function (key, value) {
if (undefined !== callbacks[key] && (undefined === values[key] || values[key] !== value)) {
callbacks[key].fire(key, value); //pass key and value so that we can use the same callback for multiple keys
Expand Down

0 comments on commit 548b005

Please sign in to comment.