Skip to content

Instantly share code, notes, and snippets.

@kcollasarundell
Created July 2, 2021 00:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kcollasarundell/5481e092a7815d3860e8e38d11d4efab to your computer and use it in GitHub Desktop.
Save kcollasarundell/5481e092a7815d3860e8e38d11d4efab to your computer and use it in GitHub Desktop.
SERVICE_CONFIG = json.dumps(
{
"methodConfig": [
{
"name": [{"service": ""}],
"retryPolicy": {
"maxAttempts": 5,
"initialBackoff": "1s",
"maxBackoff": "15s",
"backoffMultiplier": 2,
"retryableStatusCodes": ["UNAVAILABLE"],
},
}
],
"loadBalancingConfig": [{"round_robin": {}}],
}
)
if self.config.tf_retry:
options.append(("grpc.service_config", SERVICE_CONFIG))
self.channel = grpc.insecure_channel("hostname", options=options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment