Restore fake abort in thread watcher if real abort not available or doesn't go through; needed to retry.
This commit is contained in:
parent
6ea1d4ca13
commit
b102e95613
@ -175,27 +175,34 @@ ThreadWatcher =
|
|||||||
ThreadWatcher.status.textContent = '...'
|
ThreadWatcher.status.textContent = '...'
|
||||||
$.addClass ThreadWatcher.refreshButton, 'fa-spin'
|
$.addClass ThreadWatcher.refreshButton, 'fa-spin'
|
||||||
ajax = if (siteID is Site.hostname) then $.ajax else CrossOrigin.ajax
|
ajax = if (siteID is Site.hostname) then $.ajax else CrossOrigin.ajax
|
||||||
|
onloadend = ->
|
||||||
|
return if @finished
|
||||||
|
@finished = true
|
||||||
|
ThreadWatcher.fetched++
|
||||||
|
if ThreadWatcher.fetched is ThreadWatcher.requests.length
|
||||||
|
ThreadWatcher.clearRequests()
|
||||||
|
else
|
||||||
|
ThreadWatcher.status.textContent = "#{Math.round(ThreadWatcher.fetched / ThreadWatcher.requests.length * 100)}%"
|
||||||
|
cb.apply @, args
|
||||||
req = ajax url,
|
req = ajax url,
|
||||||
onloadend: ->
|
onloadend: onloadend
|
||||||
@finished = true
|
|
||||||
ThreadWatcher.fetched++
|
|
||||||
if ThreadWatcher.fetched is ThreadWatcher.requests.length
|
|
||||||
ThreadWatcher.requests = []
|
|
||||||
ThreadWatcher.fetched = 0
|
|
||||||
ThreadWatcher.status.textContent = ''
|
|
||||||
$.rmClass ThreadWatcher.refreshButton, 'fa-spin'
|
|
||||||
else
|
|
||||||
ThreadWatcher.status.textContent = "#{Math.round(ThreadWatcher.fetched / ThreadWatcher.requests.length * 100)}%"
|
|
||||||
cb.apply @, args
|
|
||||||
timeout: $.MINUTE
|
timeout: $.MINUTE
|
||||||
,
|
,
|
||||||
whenModified: if force then false else 'ThreadWatcher'
|
whenModified: if force then false else 'ThreadWatcher'
|
||||||
ThreadWatcher.requests.push req
|
ThreadWatcher.requests.push req
|
||||||
|
|
||||||
|
clearRequests: ->
|
||||||
|
ThreadWatcher.requests = []
|
||||||
|
ThreadWatcher.fetched = 0
|
||||||
|
ThreadWatcher.status.textContent = ''
|
||||||
|
$.rmClass ThreadWatcher.refreshButton, 'fa-spin'
|
||||||
|
|
||||||
abort: ->
|
abort: ->
|
||||||
for req in ThreadWatcher.requests when !req.finished
|
for req in ThreadWatcher.requests when !req.finished
|
||||||
req.abort?()
|
req.finished = true
|
||||||
return
|
try
|
||||||
|
req.abort?()
|
||||||
|
ThreadWatcher.clearRequests()
|
||||||
|
|
||||||
fetchAuto: ->
|
fetchAuto: ->
|
||||||
clearTimeout ThreadWatcher.timeout
|
clearTimeout ThreadWatcher.timeout
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user