mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
- Updated README to include supervisor configuration.
- Change logfile date format to `%Y-%m-%d %T`. - Added return types to more functions.
This commit is contained in:
parent
f69330d637
commit
4e87677517
10 changed files with 65 additions and 29 deletions
|
@ -82,7 +82,7 @@ class Resque_Worker
|
|||
* Return all workers known to Resque as instantiated instances.
|
||||
* @return array
|
||||
*/
|
||||
public static function all()
|
||||
public static function all(): array
|
||||
{
|
||||
$workers = Resque::redis()->smembers('workers');
|
||||
if (!is_array($workers)) {
|
||||
|
@ -103,7 +103,7 @@ class Resque_Worker
|
|||
* @return boolean True if the worker exists, false if not.
|
||||
* @throws Resque_RedisException
|
||||
*/
|
||||
public static function exists($workerId)
|
||||
public static function exists($workerId): bool
|
||||
{
|
||||
return (bool)Resque::redis()->sismember('workers', $workerId);
|
||||
}
|
||||
|
@ -532,14 +532,10 @@ class Resque_Worker
|
|||
*
|
||||
* @return array Array with details of current job.
|
||||
*/
|
||||
public function job()
|
||||
public function job(): array
|
||||
{
|
||||
$job = Resque::redis()->get('worker:' . $this);
|
||||
if (!$job) {
|
||||
return [];
|
||||
} else {
|
||||
return json_decode($job, true);
|
||||
}
|
||||
return $job ? json_decode($job, true) : [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue