aboutsummaryrefslogtreecommitdiff
path: root/src/jobs/LongRunningTask.php
blob: 368405587b290911d20439b0da3b7aea5b0587e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php

namespace jobs;

use jobd\exceptions\JobInterruptedException;

class LongRunningTask extends \Job
{

    public function run()
    {
        set_time_limit(0);
        sleep(120);
        echo 'ok';
    }

    public function signalHandler(int $signal)
    {
        if ($signal == 15) {
            throw new JobInterruptedException(0, 'i\'m exiting gracefully');
        }
    }

}