aboutsummaryrefslogtreecommitdiff
path: root/src/classes/Job.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-04-13 02:17:19 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-04-13 02:17:19 +0300
commit7330a35806ffc1c91f0765d1fe19df2c459d5579 (patch)
tree489bad797be3bfadcb966bbfb290dd5044f74189 /src/classes/Job.php
parent544f2444211aa1ad9e3611818fb87e8a8882ff55 (diff)
add signals example
Diffstat (limited to 'src/classes/Job.php')
-rw-r--r--src/classes/Job.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/classes/Job.php b/src/classes/Job.php
index 4ecbf6c..56052cb 100644
--- a/src/classes/Job.php
+++ b/src/classes/Job.php
@@ -48,4 +48,13 @@ abstract class Job extends model {
abstract public function run();
+ public function __construct(array $raw) {
+ parent::__construct($raw);
+
+ pcntl_async_signals(true);
+ pcntl_signal(SIGTERM, [$this, 'signalHandler']);
+ pcntl_signal(SIGINT, [$this, 'signalHandler']);
+ }
+
+ protected function signalHandler(int $signal) {}
} \ No newline at end of file