View Source sidejob_worker (sidejob v2.2.0)
This module implements the sidejob_worker logic used by all worker processes created to manage a sidejob resource. This code emulates the gen_server API, wrapping a provided user-specified module which implements the gen_server behavior.
The primary purpose of this module is updating the usage information published in a given resource's ETS table, such that capacity limiting operates correctly. The sidejob_worker also cooperates with a given sidejob_resource_stats
server to maintain statistics about a given resource.
current_usage/1
and rate/1
callbacks to change how usage is calculated. An example is the sidejob_supervisor
module which reports usage as: queue size + num_children.