fix bug that task would not retry when the previous task failed to retry

master
MaysWind 2019-08-03 02:25:29 +08:00
parent 8e9ecce36b
commit e549b7e3ae
1 changed files with 5 additions and 1 deletions

View File

@ -741,6 +741,8 @@
var failedCount = 0;
var doRetryFunc = function (task, index) {
ariaNgLogService.debug('[aria2TaskService.retryTasks] task#' + index + ', gid=' + task.gid + ' start retrying', task);
return retryTaskFunc(task.gid, function (response) {
ariaNgLogService.debug('[aria2TaskService.retryTasks] task#' + index + ', gid=' + task.gid + ', result=' + response.success, task);
@ -772,7 +774,9 @@
currentPromise = doRetryFunc(task, i);
} else {
currentPromise = (function (task, index) {
return lastPromise.then(function () {
return lastPromise.then(function onSuccess() {
return doRetryFunc(task, index);
}).catch(function onError() {
return doRetryFunc(task, index);
});
})(task, i);