Issue #3102739: Allow failing over to database or other backends if Redis is down
4 unresolved threads
Merge request reports
Activity
added 9 commits
-
1b19e2e6...905fbd8b - 8 commits from branch
project:8.x-1.x
- 00782cd6 - Issue #3102739: Resolve conflict with local rebase in order to be mergeable
-
1b19e2e6...905fbd8b - 8 commits from branch
54 58 else { 55 59 $client = new Client($connectionInfo); 56 60 } 57 return $client; 58 61 62 try { 63 $client->connect(); 64 } 65 catch (\Exception $e) { 66 if (Settings::get('redis.failover', FALSE)) { 67 watchdog_exception('redis', $e); 68 \Drupal::logger('redis')->critical('@client: Could not connect to Redis, using failover if available.', ['@client' => $this->getName()]); 56 60 } 57 return $client; 58 61 62 try { 63 $client->connect(); 64 } 65 catch (\Exception $e) { 66 if (Settings::get('redis.failover', FALSE)) { 67 watchdog_exception('redis', $e); 68 \Drupal::logger('redis')->critical('@client: Could not connect to Redis, using failover if available.', ['@client' => $this->getName()]); 69 return FALSE; 70 } 71 72 // Log an alert here because very likely intervention will be needed if 73 // Redis is down without a failover. 74 \Drupal::logger('redis')->alert('@client: Could not connect to Redis.', ['@client' => $this->getName()]); 28 if ($persistent) { 29 $client->pconnect($host, $port); 28 try { 29 if ($persistent) { 30 $client->pconnect($host, $port); 31 } 32 else { 33 $client->connect($host, $port); 34 } 30 35 } 31 else { 32 $client->connect($host, $port); 36 catch (\RedisException $e) { 37 if (Settings::get('redis.failover', FALSE)) { 38 watchdog_exception('redis', $e); 39 \Drupal::logger('redis')->critical('@client: Could not connect to Redis, using failover if available.', ['@client' => $this->getName()]); 32 else { 33 $client->connect($host, $port); 34 } 30 35 } 31 else { 32 $client->connect($host, $port); 36 catch (\RedisException $e) { 37 if (Settings::get('redis.failover', FALSE)) { 38 watchdog_exception('redis', $e); 39 \Drupal::logger('redis')->critical('@client: Could not connect to Redis, using failover if available.', ['@client' => $this->getName()]); 40 return FALSE; 41 } 42 43 // Log an alert here because very likely intervention will be needed if 44 // Redis is down without a failover. 45 \Drupal::logger('redis')->alert('@client: Could not connect to Redis.', ['@client' => $this->getName()]);
Please register or sign in to reply