Documentation ¶
Overview ¶
Example ¶
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MultiLimiter ¶
func MultiLimiter(limiters ...RateLimiter) *multiLimiter
MultiLimiter 混合多个限流桶
Example ¶
defer log.Println("Done") apiConn := Open() var wg sync.WaitGroup wg.Add(20) for i := 0; i < 10; i++ { go func() { defer wg.Done() if err := apiConn.ReadFile(context.Background()); err != nil { log.Println("cannot read file:", err) return } log.Println("read file") }() } for i := 0; i < 10; i++ { go func() { defer wg.Done() if err := apiConn.ResolveAddress(context.Background()); err != nil { log.Println("cannot resolve address:", err) return } log.Println("ResolveAddress") }() } wg.Wait()
Output:
Types ¶
Click to show internal directories.
Click to hide internal directories.