Skip to content

Commit

Permalink
Bugfix #41302 - Alternative (#41546)
Browse files Browse the repository at this point in the history
* Bugfix #41302 - Alternative

This is an alternative option to PR #41502, and adds a match
for 'socket' ("socket error when (reading|writing)") to trigger
a reconnection.

I am not sure if this is valid in other languages, too.

My personal preference would be to remove the entire if and
ALWAYS reconnect on any Exception

Signed-Off-By: Rob Thomas [email protected]

* Fix typo (used vim instead of my usual IDE)
  • Loading branch information
xrobau authored Mar 18, 2022
1 parent deb9c46 commit 4d770fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Redis/Connections/PhpRedisConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ public function command($method, array $parameters = [])
try {
return parent::command($method, $parameters);
} catch (RedisException $e) {
if (str_contains($e->getMessage(), 'went away')) {
if (str_contains($e->getMessage(), 'went away') || str_contains($e->getMessage(), 'socket')) {
$this->client = $this->connector ? call_user_func($this->connector) : $this->client;
}

Expand Down

0 comments on commit 4d770fd

Please sign in to comment.