Initial import
This commit is contained in:
4583
backend/.done
Executable file
4583
backend/.done
Executable file
File diff suppressed because it is too large
Load Diff
39
backend/JobRunner
Executable file
39
backend/JobRunner
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
$opts = getopt("c:j:");
|
||||
|
||||
$class = null;
|
||||
$jobid = null;
|
||||
|
||||
if (array_key_exists("c", $opts)) {
|
||||
$class = $opts['c'];
|
||||
}
|
||||
|
||||
if (array_key_exists("j", $opts)) {
|
||||
$jobid = $opts['j'];
|
||||
}
|
||||
|
||||
require_once(__DIR__ . "/../app.php");
|
||||
|
||||
while (true) {
|
||||
$job = Job::consumeNextJob($class);
|
||||
if ($job) {
|
||||
print("Executing job " . $job->jobID() . "\n");
|
||||
try {
|
||||
$job->run();
|
||||
$job->finish();
|
||||
} catch (PDOException $e) {
|
||||
print_r($e);
|
||||
$job->status($e->getMessage());
|
||||
$job->fail();
|
||||
} catch (Exception $e) {
|
||||
print_r($e);
|
||||
$job->status($e->get_message());
|
||||
$job->fail();
|
||||
}
|
||||
print("Job finished\n");
|
||||
} else {
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user