Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/core/src/Redis/RedisProxy.php

This file was deleted.

27 changes: 24 additions & 3 deletions src/redis/src/RedisConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Hypervel\Redis;

use Hyperf\Redis\RedisConnection as HyperfRedisConnection;
use Hypervel\Support\Arr;
use Hypervel\Support\Collection;
use Redis;
use Throwable;
Expand Down Expand Up @@ -157,7 +158,7 @@
* @method static \Redis|bool pfmerge(string $dst, array $srckeys)
* @method static \Redis|string|bool ping(string|null $message = null)
* @method static \Redis|bool psetex(string $key, int $expire, mixed $value)
* @method static bool psubscribe(array $patterns, callable $cb)
* @method static void psubscribe(array|string $channels, \Closure $callback)
* @method static \Redis|int|false pttl(string $key)
* @method static \Redis|int|false publish(string $channel, string $message)
* @method static mixed pubsub(string $command, mixed $arg = null)
Expand Down Expand Up @@ -202,7 +203,7 @@
* @method static \Redis|int|false srem(string $key, mixed $value, mixed ...$other_values)
* @method static bool ssubscribe(array $channels, callable $cb)
* @method static \Redis|int|false strlen(string $key)
* @method static bool subscribe(array $channels, callable $cb)
* @method static void subscribe(array|string $channels, \Closure $callback)
* @method static \Redis|array|bool sunsubscribe(array $channels)
* @method static \Redis|bool swapdb(int $src, int $dst)
* @method static \Redis|array time()
Expand Down Expand Up @@ -683,11 +684,31 @@ protected function callSubscribe(string $name, array $arguments): mixed
$this->connection->setOption(Redis::OPT_READ_TIMEOUT, -1);

try {
return $this->connection->{$name}(...$arguments);
return $this->connection->{$name}(
...$this->getSubscribeArguments($name, $arguments)
);
} finally {
// Restore the read timeout to the original value before
// returning to the connection pool.
$this->connection->setOption(Redis::OPT_READ_TIMEOUT, $timeout);
}
}

protected function getSubscribeArguments(string $name, array $arguments): array
{
$channels = Arr::wrap($arguments[0]);
$callback = $arguments[1];

if ($name === 'subscribe') {
return [
$channels,
fn ($redis, $channel, $message) => $callback($message, $channel),
];
}

return [
$channels,
$callback = fn ($redis, $pattern, $channel, $message) => $callback($message, $channel),
];
}
}
6 changes: 6 additions & 0 deletions src/support/src/Facades/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
* @method static array getPoolables()
* @method static \Hypervel\Queue\QueueManager setPoolables(array $poolables)
* @method static int size(string|null $queue = null)
* @method static int pendingSize(string|null $queue = null)
* @method static int delayedSize(string|null $queue = null)
* @method static int reservedSize(string|null $queue = null)
* @method static int|null creationTimeOfOldestPendingJob(string|null $queue = null)
* @method static mixed push(object|string $job, mixed $data = '', string|null $queue = null)
* @method static mixed pushOn(string|null $queue, object|string $job, mixed $data = '')
* @method static mixed pushRaw(string $payload, string|null $queue = null, array $options = [])
Expand All @@ -47,6 +51,8 @@
* @method static mixed getJobBackoff(mixed $job)
* @method static mixed getJobExpiration(mixed $job)
* @method static void createPayloadUsing(callable|null $callback)
* @method static array getConfig()
* @method static \Hypervel\Queue\Queue setConfig(array $config)
* @method static \Psr\Container\ContainerInterface getContainer()
* @method static \Hypervel\Queue\Queue setContainer(\Psr\Container\ContainerInterface $container)
* @method static \Hypervel\Support\Testing\Fakes\QueueFake except(array|string $jobsToBeQueued)
Expand Down
4 changes: 2 additions & 2 deletions src/support/src/Facades/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
* @method static \Redis|bool pfmerge(string $dst, array $srckeys)
* @method static \Redis|string|bool ping(string|null $message = null)
* @method static \Redis|bool psetex(string $key, int $expire, mixed $value)
* @method static bool psubscribe(array $patterns, callable $cb)
* @method static void psubscribe(array|string $channels, \Closure $callback)
* @method static \Redis|int|false pttl(string $key)
* @method static \Redis|int|false publish(string $channel, string $message)
* @method static mixed pubsub(string $command, mixed $arg = null)
Expand Down Expand Up @@ -216,7 +216,7 @@
* @method static \Redis|int|false srem(string $key, mixed $value, mixed ...$other_values)
* @method static bool ssubscribe(array $channels, callable $cb)
* @method static \Redis|int|false strlen(string $key)
* @method static bool subscribe(array $channels, callable $cb)
* @method static void subscribe(array|string $channels, \Closure $callback)
* @method static \Redis|array|bool sunsubscribe(array $channels)
* @method static \Redis|bool swapdb(int $src, int $dst)
* @method static \Redis|array time()
Expand Down