elimination exec in new goroutine

check whether cog cpu is still very high
This commit is contained in:
siddontang 2014-07-07 16:39:36 +08:00
parent 0fd6c150e8
commit ca8c4e931d
1 changed files with 8 additions and 3 deletions

View File

@ -165,12 +165,17 @@ func (l *Ledis) activeExpireCycle() {
go func() { go func() {
tick := time.NewTicker(1 * time.Second) tick := time.NewTicker(1 * time.Second)
end := false end := false
done := make(chan struct{})
for !end { for !end {
select { select {
case <-tick.C: case <-tick.C:
for _, eli := range executors { go func() {
eli.active() for _, eli := range executors {
} eli.active()
}
done <- struct{}{}
}()
<-done
case <-l.quit: case <-l.quit:
end = true end = true
break break