Limit Concurrency and Inspect the Supervisors
Explore how to enforce concurrency limits in Elixir jobs and inspect supervision trees at runtime. Understand using GenServer callbacks, Registry for process lookup, and count_children to monitor active and supervised processes.
We'll cover the following...
We'll cover the following...
Limit the concurrency of import jobs
We now put our new running_imports/0 to use. Let’s add this check to Jobber.start_job/1:
Try starting more than five jobs. After the fifth attempt, we should see this error result: {:error, :import_quota_reached}.
This is the executable ...
Here’s the output we get:
iex(1)> ...