Added ability to restart tasks that have been completed

pull/1/head
Piero Toffanin 2016-11-04 10:04:18 -04:00
rodzic 5ea69e5e66
commit 038940860d
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -273,9 +273,9 @@ module.exports = class Task{
}
// Re-executes the task (by setting it's state back to QUEUED)
// Only tasks that have been canceled or have failed can be restarted.
// Only tasks that have been canceled, completed or have failed can be restarted.
restart(cb){
if (this.status.code === statusCodes.CANCELED || this.status.code === statusCodes.FAILED){
if ([statusCodes.CANCELED, statusCodes.FAILED, statusCodes.COMPLETED].indexOf(this.status.code) !== -1){
this.setStatus(statusCodes.QUEUED);
this.dateCreated = new Date().getTime();
this.output = [];