small fix

This commit is contained in:
iamqizhao 2015-07-28 17:00:35 -07:00
parent bdccc897b0
commit 3aeeefd6e7
1 changed files with 5 additions and 1 deletions

View File

@ -104,9 +104,13 @@ type quotaPool struct {
// newQuotaPool creates a quotaPool which has quota q available to consume.
func newQuotaPool(q int) *quotaPool {
qb := &quotaPool{c: make(chan int, 1)}
qb := &quotaPool{
c: make(chan int, 1),
}
if q > 0 {
qb.c <- q
} else {
qb.quota = q
}
return qb
}