EsCircuitBreaker
in package
FinalYes
Outage circuit breaker for Elasticsearch, shared by the read and write paths.
The state lives in the Redis key es:{indexPrefix}:down with a 60 s ttl. While open, ES calls
are skipped without waiting for timeouts; writes missed meanwhile are caught up by sync or full
reindex. Without Redis the breaker does nothing and degradation relies only on the short request
timeouts of the client.
Table of Contents
Constants
- KEY_SUFFIX : mixed = 'down'
- TTL : mixed = 60
Properties
Methods
- __construct() : mixed
- isOpen() : bool
- open() : void
- openFor() : void
- Opens the breaker only for outage errors. A 4xx response (`ClientResponseException`, e.g. 404 for a missing index before bootstrap or a malformed query) is not a cluster outage and must not switch search off for everyone.
Constants
KEY_SUFFIX
private
mixed
KEY_SUFFIX
= 'down'
TTL
private
mixed
TTL
= 60
Properties
$config read-only
private
EsConfig
$config
= new EsConfig()
$redis read-only
private
Client|null
$redis
= null
Methods
__construct()
public
__construct([Client|null $redis = null ][, EsConfig $config = new EsConfig() ]) : mixed
Parameters
isOpen()
public
isOpen() : bool
Return values
boolopen()
public
open() : void
openFor()
Opens the breaker only for outage errors. A 4xx response (`ClientResponseException`, e.g. 404 for a missing index before bootstrap or a malformed query) is not a cluster outage and must not switch search off for everyone.
public
openFor(Throwable $e) : void
Parameters
- $e : Throwable