What's the best way to implement a python retry mechanism for failed operations? or How do you handle

20 Replies, 1891 Views

"What's the best way to implement a python retry mechanism for failed operations?"

Hey folks!

I've been banging my head against this one—how do *you* handle python retry logic for flaky ops? Like, APIs that timeout or DB calls that randomly fail.

I’ve tried rolling my own with `while` loops and `try/except`, but it feels clunky. Found `tenacity` and `retrying` libs, but curious if there’s a cleaner way.

Do y'all prefer decorators? Configurable backoffs? Or just brute-force retries?

Also, how do you handle logging—spammy or just fail silently until max retries?

Kinda new to this, so any tips or war stories would be awesome.

Thanks! 🚀

Messages In This Thread
What's the best way to implement a python retry mechanism for failed operations? or How do you handle - by - 28-08-2024, 03:05 PM



Users browsing this thread: 1 Guest(s)