1. add cron module
2. add pool module
3. add tcgplayer background job
4. add card price model
This commit is contained in:
Jay
2019-01-16 16:53:08 +08:00
parent 6a41584aa2
commit 273278d322
68 changed files with 10668 additions and 5 deletions
+38
View File
@@ -0,0 +1,38 @@
package pool
import "sync"
// Pool -
type Pool struct {
queue chan bool
wg *sync.WaitGroup
}
// NewPool -
func NewPool(size int) *Pool {
if size < 1 {
size = 1
}
p := &Pool{
queue: make(chan bool, size),
wg: &sync.WaitGroup{},
}
return p
}
// Add -
func (p *Pool) Add() {
p.queue <- true
p.wg.Add(1)
}
// Done -
func (p *Pool) Done() {
<-p.queue
p.wg.Done()
}
// Wait -
func (p *Pool) Wait() {
p.wg.Wait()
}