fix bug that task would not retry when the previous task failed to retry
This commit is contained in:
parent
8e9ecce36b
commit
e549b7e3ae
|
@ -741,6 +741,8 @@
|
||||||
var failedCount = 0;
|
var failedCount = 0;
|
||||||
|
|
||||||
var doRetryFunc = function (task, index) {
|
var doRetryFunc = function (task, index) {
|
||||||
|
ariaNgLogService.debug('[aria2TaskService.retryTasks] task#' + index + ', gid=' + task.gid + ' start retrying', task);
|
||||||
|
|
||||||
return retryTaskFunc(task.gid, function (response) {
|
return retryTaskFunc(task.gid, function (response) {
|
||||||
ariaNgLogService.debug('[aria2TaskService.retryTasks] task#' + index + ', gid=' + task.gid + ', result=' + response.success, task);
|
ariaNgLogService.debug('[aria2TaskService.retryTasks] task#' + index + ', gid=' + task.gid + ', result=' + response.success, task);
|
||||||
|
|
||||||
|
@ -772,7 +774,9 @@
|
||||||
currentPromise = doRetryFunc(task, i);
|
currentPromise = doRetryFunc(task, i);
|
||||||
} else {
|
} else {
|
||||||
currentPromise = (function (task, index) {
|
currentPromise = (function (task, index) {
|
||||||
return lastPromise.then(function () {
|
return lastPromise.then(function onSuccess() {
|
||||||
|
return doRetryFunc(task, index);
|
||||||
|
}).catch(function onError() {
|
||||||
return doRetryFunc(task, index);
|
return doRetryFunc(task, index);
|
||||||
});
|
});
|
||||||
})(task, i);
|
})(task, i);
|
||||||
|
|
Reference in a new issue