Total Complexity | 3 |
Total Lines | 32 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
14 | class PID |
||
15 | { |
||
16 | /** |
||
17 | * Create a new PID tracker item for the supplied job ID. |
||
18 | * |
||
19 | * @param string $id The ID of the job to track the PID of. |
||
20 | */ |
||
21 | public static function create($id) |
||
22 | { |
||
23 | Resque::redis()->set('job:' . $id . ':pid', (string)getmypid()); |
||
|
|||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Fetch the PID for the process actually executing the job. |
||
28 | * |
||
29 | * @param string $id The ID of the job to get the PID of. |
||
30 | * |
||
31 | * @return int PID of the process doing the job (on non-forking OS, PID of the worker, otherwise forked PID). |
||
32 | */ |
||
33 | public static function get($id) |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Remove the PID tracker for the job. |
||
40 | * |
||
41 | * @param string $id The ID of the job to remove the tracker from. |
||
42 | */ |
||
43 | public static function del($id) |
||
48 |