[gnome-ostree] task: Fix up some logic errors
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree] task: Fix up some logic errors
- Date: Mon, 11 Feb 2013 10:47:05 +0000 (UTC)
commit 4a17edf61d0545ffb360db53cc6283bf5c3e7be5
Author: Colin Walters <walters verbum org>
Date: Mon Feb 11 05:46:39 2013 -0500
task: Fix up some logic errors
src/ostbuild/js/task.js | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/ostbuild/js/task.js b/src/ostbuild/js/task.js
index 0f6c3a6..fb12fa7 100644
--- a/src/ostbuild/js/task.js
+++ b/src/ostbuild/js/task.js
@@ -106,8 +106,6 @@ const TaskMaster = new Lang.Class({
},
pushTask: function(taskName, parameters) {
- if (this.isTaskQueued(taskName))
- return;
let [taskDef, vars] = this._taskset.getTask(taskName);
let instance = new taskDef(this, taskName, vars, parameters);
instance.onComplete = Lang.bind(this, this._onComplete, instance);
@@ -118,12 +116,16 @@ const TaskMaster = new Lang.Class({
isTaskQueued: function(taskName) {
for (let i = 0; i < this._pendingTasksList.length; i++) {
let pending = this._pendingTasksList[i];
- if (pending.TaskName == taskName)
+ if (pending.name == taskName)
return true;
}
+ return this.isTaskExecuting(taskName);
+ },
+
+ isTaskExecuting: function(taskName) {
for (let i = 0; i < this._executing.length; i++) {
let executingTask = this._executing[i];
- if (executingTask.TaskName == taskName)
+ if (executingTask.name == taskName)
return true;
}
return false;
@@ -178,7 +180,8 @@ const TaskMaster = new Lang.Class({
_reschedule: function() {
while (this._executing.length < this.maxConcurrent &&
- this._pendingTasksList.length > 0) {
+ this._pendingTasksList.length > 0 &&
+ !this.isTaskExecuting(this._pendingTasksList[0].name)) {
let task = this._pendingTasksList.shift();
task._executeInSubprocessInternal(this.cancellable);
this._executing.push(task);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]