[gnome-continuous/wip/new-model: 11/15] task: Don't do as much work if a task hasn't changed
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous/wip/new-model: 11/15] task: Don't do as much work if a task hasn't changed
- Date: Tue, 8 Oct 2013 17:02:57 +0000 (UTC)
commit c625cb5ae2460dfd5de4c5da37599d6083611ae2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Mon Sep 30 15:21:20 2013 -0400
task: Don't do as much work if a task hasn't changed
src/js/task.js | 26 +++++++++++++++-----------
1 files changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/src/js/task.js b/src/js/task.js
index b861122..1a2b92f 100644
--- a/src/js/task.js
+++ b/src/js/task.js
@@ -283,17 +283,18 @@ const TaskMaster = new Lang.Class({
if (idx == -1)
throw new Error("TaskMaster: Internal error - Failed to find completed task:" +
runner.taskData.name);
this._executing.splice(idx, 1);
+ if (!runner.changed)
+ return;
+
this.emit('task-complete', runner, success, error);
if (success && this._processAfter) {
- if (runner.changed) {
- let taskName = runner.taskData.name;
- let taskDef = runner.taskData.taskDef;
- let after = this._taskset.getTasksAfter(taskName);
- for (let i = 0; i < after.length; i++) {
- let afterTaskName = after[i];
- if (!this._skipTasks[afterTaskName])
- this.pushTask(afterTaskName, {});
- }
+ let taskName = runner.taskData.name;
+ let taskDef = runner.taskData.taskDef;
+ let after = this._taskset.getTasksAfter(taskName);
+ for (let i = 0; i < after.length; i++) {
+ let afterTaskName = after[i];
+ if (!this._skipTasks[afterTaskName])
+ this.pushTask(afterTaskName, {});
}
}
this._queueRecalculate();
@@ -477,18 +478,21 @@ const TaskRunner = new Lang.Class({
this.changed = data['modified'];
}
+ this.onComplete(success, errmsg);
+
+ if (!this.changed)
+ return;
+
if (!success) {
target = this._failedDir.path.get_child(this._version);
GSystem.file_rename(this._taskCwd, target, null);
this._taskCwd = target;
this._failedDir.cleanOldVersions(this.taskData.taskDef.RetainFailed, null);
- this.onComplete(success, errmsg);
} else {
target = this._successDir.path.get_child(this._version);
GSystem.file_rename(this._taskCwd, target, null);
this._taskCwd = target;
this._successDir.cleanOldVersions(this.taskData.taskDef.RetainSuccess, null);
- this.onComplete(success, null);
}
let elapsedMillis = GLib.get_monotonic_time() / 1000 - this._startTimeMillis;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]