Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrencyLimit ¶
type ConcurrencyLimit struct {
// contains filtered or unexported fields
}
ConcurrencyLimit enforce a concurrency limit with tokens that need to be held by routines. A Token can be acquired by calling Acquire(), and MUST be released by calling Token.Release().
func New ¶
func New(dbname, name string, limit int, logger logrus.FieldLogger) *ConcurrencyLimit
New creates a new ConcurrencyLimit with a given limit. The name is used for Prometheus metrics.
func (*ConcurrencyLimit) Acquire ¶
func (cl *ConcurrencyLimit) Acquire() *Token
Acquire acquires a Token. It will block until a free Token is available. You MUST call Token.Release() when you are done with the operation.
Click to show internal directories.
Click to hide internal directories.