Permalink
Browse files

Small refactor; update tests

  • Loading branch information...
1 parent e0a9ad8 commit 623d572ae9aa463a3d479461a10939ddb61b2bbe @thousandsofthem thousandsofthem committed Feb 8, 2013
Showing with 13 additions and 14 deletions.
  1. +13 −13 IronWorker.class.php
  2. BIN iron_worker.phar
  3. +0 −1 test/test_queuing.php
View
@@ -439,19 +439,6 @@ public function deleteTask($task_id){
return $this->cancelTask($task_id);
}
- public function setTaskProgress($task_id, $percent, $msg = ''){
- if (empty($task_id)){
- throw new InvalidArgumentException("Please set task_id");
- }
- $url = "projects/{$this->project_id}/tasks/$task_id/progress";
- $request = array(
- 'percent' => $percent,
- 'msg' => $msg
- );
-
- $this->setCommonHeaders();
- return self::json_decode($this->apiCall(self::POST, $url, $request));
- }
/**
* Wait while the task specified by task_id executes
*
@@ -522,6 +509,7 @@ public function postSchedule($name, $options, $payload = array()){
* $worker->setProgress($task_id, 50, "Task is half-done");
* </code>
*
+ * @param string $task_id Task ID
* @param int $percent An integer, between 0 and 100 inclusive, that describes the completion of the task.
* @param string $msg Any message or data describing the completion of the task. Must be a string value, and the 64KB request limit applies.
* @return mixed
@@ -543,6 +531,18 @@ public function setProgress($task_id, $percent, $msg = ''){
}
/**
+ * Alias for setProgress()
+ *
+ * @param string $task_id Task ID
+ * @param int $percent
+ * @param string $msg
+ * @return mixed
+ */
+ public function setTaskProgress($task_id, $percent, $msg = ''){
+ return $this->setProgress($task_id, $percent, $msg);
+ }
+
+ /**
* Set a Task’s Progress. Work only inside a worker
*
* Example (inside a worker):
View
Binary file not shown.
@@ -68,7 +68,6 @@ function testPostTaskOptions(){
$this->assertEqual($details->status, 'queued');
$this->assertEqual($details->priority, 2);
$this->assertEqual($details->delay, 10);
- sleep(10);
$details = $this->worker->waitFor($task_id, 4, 60);
$this->assertEqual($details->status, 'complete');
}

0 comments on commit 623d572

Please sign in to comment.