wip matches
This commit is contained in:
1 parent
adb15e701b
commit
7116d3c576
33 files changed
+379
-176
No files matched your search
@@ -16,32 +16,32 @@ class Supervisorctl
|
||||
{
|
||||
$debug = $options['d'] ?? 0;
|
||||
|
||||
// sleep 1 sec to avoid error in supervisor
|
||||
sleep(1);
|
||||
// sleep for 0,5 seconds
|
||||
usleep(500000);
|
||||
|
||||
self::$starttime = microtime(true);
|
||||
|
||||
self::$code = $options['code'];
|
||||
self::$code = $options['supervisor_id'];
|
||||
|
||||
$supervisor = Supervisor::where('code', self::$code)->get()->first();
|
||||
$supervisor = Supervisor::find(self::$code);
|
||||
|
||||
// if process can be called only from bash
|
||||
if ($supervisor) {
|
||||
$options['sport_id'] = $supervisor->sport_id;
|
||||
$options['customer_id'] = $supervisor->customer_id;
|
||||
$options['limit'] = $supervisor->limit;
|
||||
|
||||
if ($debug) {
|
||||
Notice::note('supervisor start '.self::$code, 'g');
|
||||
}
|
||||
|
||||
if ($supervisor->sleep > 0) {
|
||||
$options = array_merge($options, $supervisor->toArray());
|
||||
|
||||
if ($options['sleep'] > 0) {
|
||||
if (! $debug) {
|
||||
sleep($supervisor->sleep);
|
||||
sleep($options['sleep']);
|
||||
} else {
|
||||
Notice::note('without debug process sleeps for '.$options['sleep'].'sec', 'g');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Notice::note('unknown supervisor: '.$options['code'], 'r', 1);
|
||||
Notice::note('unknown supervisor: '.self::$code, 'r', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class Supervisorctl
|
||||
{
|
||||
$processend = microtime(true);
|
||||
$runtime = round(($processend - self::$starttime) / 60, 3);
|
||||
Supervisor::where('code', self::$code)->update(['runtime' => $runtime, 'events' => self::$events]);
|
||||
Supervisor::where('id', self::$code)->update(['runtime' => $runtime, 'events' => self::$events]);
|
||||
if ($options['d']) {
|
||||
Notice::note('spervisor time: '.$runtime.' min', 'g');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user