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() {
tick := time.NewTicker(1 * time.Second)
end := false
done := make(chan struct{})
for !end {
select {
case <-tick.C:
go func() {
for _, eli := range executors {
eli.active()
}
done <- struct{}{}
}()
<-done
case <-l.quit:
end = true
break