Rate-limiting outbound requests to match an external service API limits, where the rate and concurrency limits are set per organization/group.
A DynamicSupervisor implementation for managing OrganizationWorker children.
A new organization worker can be added by:
OrganizationSupervisor.add_organization("org-id")This initiates the OrganizationWorker child with an empty queue.
Go to OrganizationSupervisor code.
Processes the queue of requests for the given organization. The level of concurrency (number of requests to pull from queue at one time) can be predefined in the OrganizationWorker module attribute @concurrency (default is 3).
Adding new requests can be done by:
OrganizationWorker.enqueue("org-id", fn ->
HTTPoison.get("http://...")
end)