Documentation ¶
Index ¶
Constants ¶
View Source
const ( GET throttlerOperationType = iota DELETE EXPIRE )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Throttler ¶
type Throttler struct {
// contains filtered or unexported fields
}
Throttler is a simple throttling mechanism that provides the abil- ity to limit the total amount of requests to do the same thing at the same time.
In router, for example, multiple goroutines may try to get the la- test service URL from executor when there is no service URL entry in the cache and caused executor overloaded because of receiving massive requests. With throttler, we can easily limit there is at most one requests being sent to executor.
func MakeThrottler ¶
MakeThrottler returns a throttler that able to limit total amounts of goroutines from doing the same thing at the same time.
Click to show internal directories.
Click to hide internal directories.