mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Remove usage of setInterval (#4481)
* Migrate from setInterval to setTimeout, fixes #4480 * Add fail case
This commit is contained in:
parent
813cb7093c
commit
2ac87ba839
1 changed files with 19 additions and 16 deletions
|
@ -19,7 +19,8 @@ Sidekiq = {};
|
|||
$(function() {
|
||||
var pollpath = $('body').data('poll-path');
|
||||
if (pollpath != "") {
|
||||
updatePage(pollpath);
|
||||
var ti = parseInt(localStorage.timeInterval) || 2000;
|
||||
setTimeout(function(){updatePage(pollpath)}, ti);
|
||||
}
|
||||
|
||||
$(document).on('click', '.check_all', function() {
|
||||
|
@ -55,26 +56,28 @@ function updateFuzzyTimes(locale) {
|
|||
}
|
||||
|
||||
function updatePage(url) {
|
||||
setInterval(function () {
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: 'html'
|
||||
}).done(function (data) {
|
||||
$data = $(data)
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: 'html'
|
||||
}).done(function(data) {
|
||||
$data = $(data)
|
||||
|
||||
var $page = $data.filter('#page')
|
||||
$('#page').replaceWith($page)
|
||||
var $page = $data.filter('#page')
|
||||
$('#page').replaceWith($page)
|
||||
|
||||
var $header_status = $data.find('.status')
|
||||
$('.status').replaceWith($header_status)
|
||||
var $header_status = $data.find('.status')
|
||||
$('.status').replaceWith($header_status)
|
||||
|
||||
updateFuzzyTimes($('body').data('locale'));
|
||||
})
|
||||
}, parseInt(localStorage.timeInterval) || 2000);
|
||||
updateFuzzyTimes($('body').data('locale'));
|
||||
|
||||
var ti = parseInt(localStorage.timeInterval) || 2000;
|
||||
setTimeout(function(){updatePage(url)}, ti)
|
||||
}).fail(function() {
|
||||
var ti = parseInt(localStorage.timeInterval) || 2000;
|
||||
setTimeout(function(){updatePage(url)}, ti)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(function() {
|
||||
'use strict';
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue