Skip to content

Instantly share code, notes, and snippets.

@kargirwar
Last active November 18, 2017 13:29
Show Gist options
  • Save kargirwar/4534a83d7c35cc5d750b23cb7bc98336 to your computer and use it in GitHub Desktop.
Save kargirwar/4534a83d7c35cc5d750b23cb7bc98336 to your computer and use it in GitHub Desktop.
<?php
public function run() {
while ($this->mWorker->work()) {
if ($this->mWorker->returnCode() != GEARMAN_SUCCESS) {
throw new \Exception("Fatal Error");
}
}
}
public function report(\GearmanJob $job) {
//simulate long running task
sleep(1);
echo "\nYay!Sent the report to " . $job->workload() . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment