Restart worker permanently with timeout

I have a top level Supervisor and a worker called Poller. What I’m looking for is to restart Poller permanently with a timeout. I.e. when internet connection lost for 10 mins. After trying to implement that with Supervisor but later I thought this not a right way to do that. What are the alternatives or where I’m wrong?

Here is the link to my project: https://github.com/styx/enbot

1 Like

I think this is a recurring question already. Check out this thread:

(it also links to other threads).

tl;dr: you don’t use supervisors to deal with external resource failures. Instead you need to implement handling of such failures, since they are expected behaviors.

Supervisors are used to handle internal failures, that are exceptional by definition.

2 Likes

That clears the topic for me at last. See you’ve been wandering on the same issue. I never found info where Sup shouldn’t be used but have thoughts on that. Now I have a proof! Thanks.

Yes it wasn’t clear for me either. I started squeezing in the supervisors everywhere and made my processes crash too often and use it as a flow control mechanism. This is clearly as bad as using exceptions / catching them to do control flow.