Skip to content

Commit 22bdc4d

Browse files
HazATantonpirker
andauthored
ref: Add max tries to Spotlight (#2571)
Co-authored-by: Anton Pirker <[email protected]>
1 parent 9bb6bdf commit 22bdc4d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

sentry_sdk/spotlight.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ def __init__(self, url):
1717
# type: (str) -> None
1818
self.url = url
1919
self.http = urllib3.PoolManager()
20+
self.tries = 0
2021

2122
def capture_envelope(self, envelope):
2223
# type: (Envelope) -> None
24+
if self.tries > 3:
25+
logger.warning(
26+
"Too many errors sending to Spotlight, stop sending events there."
27+
)
28+
return
2329
body = io.BytesIO()
2430
envelope.serialize_into(body)
2531
try:
@@ -33,7 +39,8 @@ def capture_envelope(self, envelope):
3339
)
3440
req.close()
3541
except Exception as e:
36-
logger.exception(str(e))
42+
self.tries += 1
43+
logger.warning(str(e))
3744

3845

3946
def setup_spotlight(options):

0 commit comments

Comments
 (0)