Merge "Fix NewConnectionError Try Again" into mcp/xenial/extra
diff --git a/sf_notifier/salesforce/client.py b/sf_notifier/salesforce/client.py
index d3979e8..f4a8096 100644
--- a/sf_notifier/salesforce/client.py
+++ b/sf_notifier/salesforce/client.py
@@ -4,12 +4,14 @@
import time
import uuid
from contextlib import contextmanager
+from urllib3.util.retry import Retry
from cachetools import TTLCache
from prometheus_client import Counter, Gauge
from requests import Session
+from requests.adapters import HTTPAdapter
from requests.exceptions import ConnectionError as RequestsConnectionError
from simple_salesforce import Salesforce
@@ -93,6 +95,12 @@
self.environment = self.config.pop('environment_id')
self.sf = None
self.session = Session()
+
+ retry = Retry(connect=3, backoff_factor=0.5)
+ adapter = HTTPAdapter(max_retries=retry)
+ self.session.mount('http://', adapter)
+ self.session.mount('https://', adapter)
+
self.auth(no_retry=True)
@staticmethod