I have used jobs (GitHub - uwiger/jobs: Job scheduler for load regulation · GitHub) for these kind of things before. It allows you to have a queue which is regulated based on CPU sampling for example.
Or you can use a “circuit breaker” library to deal with this. They generally implement the correct algorithms for this. I’ve used fuse (GitHub - jlouis/fuse: A Circuit Breaker for Erlang · GitHub) in the past but it hasn’t had any updates the last couple of years so don’t know if it will work with the latest erlang versions.






















