|
@ -12,6 +12,8 @@ var baseUrl = function () { |
|
|
return $.SickGear.Root; |
|
|
return $.SickGear.Root; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
var reloading = false |
|
|
|
|
|
|
|
|
var ajaxConsumer = function () { |
|
|
var ajaxConsumer = function () { |
|
|
var that = this; |
|
|
var that = this; |
|
|
that.timeoutId = 0; |
|
|
that.timeoutId = 0; |
|
@ -29,7 +31,8 @@ var ajaxConsumer = function () { |
|
|
uiUpdateComplete(data.message); |
|
|
uiUpdateComplete(data.message); |
|
|
}) |
|
|
}) |
|
|
.fail(function (jqXHR, textStatus, errorThrown) { |
|
|
.fail(function (jqXHR, textStatus, errorThrown) { |
|
|
if (404 === jqXHR.status) { |
|
|
if (404 === jqXHR.status && !reloading) { |
|
|
|
|
|
reloading = true; |
|
|
putMsg('Finished loading. Reloading page'); |
|
|
putMsg('Finished loading. Reloading page'); |
|
|
location.reload(); |
|
|
location.reload(); |
|
|
} |
|
|
} |
|
@ -37,10 +40,12 @@ var ajaxConsumer = function () { |
|
|
}) |
|
|
}) |
|
|
.always(function (jqXHR, textStatus) { |
|
|
.always(function (jqXHR, textStatus) { |
|
|
clearTimeout(that.timeoutId); |
|
|
clearTimeout(that.timeoutId); |
|
|
|
|
|
if (!reloading){ |
|
|
if (that.pollInterval) |
|
|
if (that.pollInterval) |
|
|
that.timeoutId = setTimeout(ajaxConsumer.checkLoadNotifications, that.pollInterval); |
|
|
that.timeoutId = setTimeout(ajaxConsumer.checkLoadNotifications, that.pollInterval); |
|
|
logInfo(that.pollInterval ? '^-- ' + that.pollInterval/1000 + 's to next work' : '^-- no more work'); |
|
|
logInfo(that.pollInterval ? '^-- ' + that.pollInterval/1000 + 's to next work' : '^-- no more work'); |
|
|
logInfo('===='); |
|
|
logInfo('===='); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|