gen_agent
is a behavior to make resource fetching with backoff and retry logic easy to implement. In a general context, it can be used to implement any task that may require retrying something with a backoff between attempts.
This project grew out of an attempt to address a recurring supervisor feature request: delaying the restart of failing children, namely when the children in question depend on an external resource which may be temporarily down, ie where retrying would help, but not frantic retrying.
The subject has been discussed over and over again, and while it would help in the case mentioned, it is a bad idea generally (and we (@juhlig and I) know, as we tried a general solution earlier this year).
There are known better ways to address this, but they are also leagues away from a simple knob on the supervisor, usually boiling down to “roll your own state machine with custom backoff and retry logic”.
gen_agent
is an attempt to make this common task easier, ie to let an implementor focus on how to obtain a resource and not have to worry too much about implementing the retry logic and then bake it all into the component that will be using it.
It is still in its early stages, and so the documentation is messy and consist only of the README
and two examples, no tests, and there are probably a number of bugs.
However, we think it has by now evolved to a point where it would be nice to have some feedback from the community.
Generally, we put focus mainly on simplicity, not on flexibility. The more flexibility you want, the more it becomes just like a gen_statem
.
So if you are interested, you are welcome to take a look and try it out.
We would like to know if you think this project would be useful (or not), for yourself and/or others, even if not in the state it is currently in.
What is missing, what is strange, what is dangerous, what is downright nonsense?
Convenience features are currently not on the top of our list, we want to build a minimal, solid, generally useful “core” first.