Automatic reconnection on memcached #11
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added module
reconnecting.py
with clientReconnectingClient
:Automatic reconnection on memcached network/server failures.
Optional monkey-patch replacing
memcache.Client
.Configuration via environment variables:
MCDUTILS_DISABLE_RECONNECT
(disables).MCDUTILS_BACKOFF_MIN_MS
andMCDUTILS_BACKOFF_MAX_MS
(backoff intervals).MCDUTILS_LOG
/MCDUTILS_LOG_LEVEL
(structured logs).MCDUTILS_METRICS
(enables internal metrics).Prometheus metrics export via function
export_prometheus_textfile
.Implemented automatic retry in
tpc_vote
ofMemCacheMapping
:New function
_tpc_vote_with_retry
encapsulatesMemCacheError
failures.Configuration via environment variables:
MCDUTILS_DISABLE_TPC_RETRY
(disables retry).MCDUTILS_TPC_RETRY_ATTEMPTS
(number of extra attempts).MCDUTILS_TPC_RETRY_BACKOFF_MS
(time between attempts).Additional metrics registration:
tpc_retry_attempts_total
,tpc_retry_success_total
,tpc_retry_fail_total
and accumulated backoff times.