resque /
php-resque
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * PID tracker for the forked worker job. |
||||
| 5 | * |
||||
| 6 | * @package Resque/Job |
||||
| 7 | * @author Chris Boulton <[email protected]> |
||||
| 8 | * @license http://www.opensource.org/licenses/mit-license.php |
||||
| 9 | */ |
||||
| 10 | class Resque_Job_PID |
||||
| 11 | { |
||||
| 12 | /** |
||||
| 13 | * Create a new PID tracker item for the supplied job ID. |
||||
| 14 | * |
||||
| 15 | * @param string $id The ID of the job to track the PID of. |
||||
| 16 | */ |
||||
| 17 | public static function create($id) |
||||
| 18 | { |
||||
| 19 | Resque::redis()->set('job:' . $id . ':pid', (string)getmypid()); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 20 | } |
||||
| 21 | |||||
| 22 | /** |
||||
| 23 | * Fetch the PID for the process actually executing the job. |
||||
| 24 | * |
||||
| 25 | * @param string $id The ID of the job to get the PID of. |
||||
| 26 | * |
||||
| 27 | * @return int PID of the process doing the job (on non-forking OS, PID of the worker, otherwise forked PID). |
||||
| 28 | 3 | */ |
|||
| 29 | public static function get($id) |
||||
| 30 | 3 | { |
|||
| 31 | return (int)Resque::redis()->get('job:' . $id . ':pid'); |
||||
|
0 ignored issues
–
show
The method
get() does not exist on Resque_Redis. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 32 | } |
||||
| 33 | |||||
| 34 | /** |
||||
| 35 | * Remove the PID tracker for the job. |
||||
| 36 | * |
||||
| 37 | * @param string $id The ID of the job to remove the tracker from. |
||||
| 38 | */ |
||||
| 39 | public static function del($id) |
||||
| 40 | { |
||||
| 41 | Resque::redis()->del('job:' . $id . ':pid'); |
||||
|
0 ignored issues
–
show
The method
del() does not exist on Resque_Redis. Since you implemented __call, consider adding a @method annotation.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 42 | } |
||||
| 43 | } |
||||
| 44 |