-
Notifications
You must be signed in to change notification settings - Fork 11.5k
[10.x] Remove serializer and compression for RedisQueue #48180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
use Illuminate\Contracts\Queue\Queue as QueueContract; | ||
use Illuminate\Contracts\Redis\Factory as Redis; | ||
use Illuminate\Queue\Jobs\RedisJob; | ||
use Illuminate\Redis\Connections\PhpRedisConnection; | ||
use Illuminate\Support\Str; | ||
|
||
class RedisQueue extends Queue implements QueueContract, ClearableQueue | ||
|
@@ -54,6 +55,13 @@ class RedisQueue extends Queue implements QueueContract, ClearableQueue | |
*/ | ||
protected $migrationBatchSize = -1; | ||
|
||
/** | ||
* The redis connection instance. | ||
* | ||
* @var \Illuminate\Redis\Connections\Connection | ||
*/ | ||
protected $redisConnection; | ||
|
||
/** | ||
* Create a new Redis queue instance. | ||
* | ||
|
@@ -367,7 +375,24 @@ public function getQueue($queue) | |
*/ | ||
public function getConnection() | ||
{ | ||
return $this->redis->connection($this->connection); | ||
if (isset($this->redisConnection)) { | ||
return $this->redisConnection; | ||
} | ||
|
||
$this->redisConnection = $this->redis->connection($this->connection); | ||
|
||
if ($this->redisConnection instanceof PhpRedisConnection) { | ||
$this->redisConnection = $this->redis->resolve($this->connection); | ||
|
||
if (defined('\Redis::OPT_COMPRESSION') && $this->redisConnection->client()->getOption(\Redis::OPT_COMPRESSION) !== \Redis::COMPRESSION_NONE) { | ||
$this->redisConnection->client()->setOption(\Redis::OPT_COMPRESSION, \Redis::COMPRESSION_NONE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't access There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for your input. Since I will have to change that code, I will wait for Taylors answer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because |
||
} | ||
if (defined('\Redis::OPT_SERIALIZER') && $this->redisConnection->client()->getOption(\Redis::OPT_SERIALIZER) !== \Redis::SERIALIZER_NONE) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$this->redisConnection->client()->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_NONE); | ||
} | ||
} | ||
|
||
return $this->redisConnection; | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OPT_COMPRESSION
is always defined.