Skip to content

Commit

Permalink
Grab the Retry-After header
Browse files Browse the repository at this point in the history
use that if it's there instead of the specified refresh_interval
  • Loading branch information
Joe Flateau committed Jul 25, 2012
1 parent 9877a44 commit 498505d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tweet/jquery.tweet.js
Expand Up @@ -238,9 +238,13 @@

$(widget).trigger("loaded").trigger((tweets.length === 0 ? "empty" : "full"));
},
complete:function(){
if (s.refresh_interval) {
window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * s.refresh_interval);
complete:function(jqXHR){
var refresh = s.refresh_interval;
if (jqXHR.getResponseHeader("Retry-After")) {
refresh = parseInt(jqXHR.getResponseHeader("Retry-After"));
}
if (refresh) {
window.setTimeout(function() { $(widget).trigger("tweet:load"); }, 1000 * refresh);
}
}
});
Expand Down

0 comments on commit 498505d

Please sign in to comment.