proc: 防止 proc 停止后仍往 etcd 写入

timer close 后,timer.C 不阻塞
pull/1/head
miraclesu 2017-03-20 11:25:26 +08:00
parent afad3d5736
commit ecc6883e20
1 changed files with 3 additions and 2 deletions

View File

@ -175,7 +175,7 @@ func (j *Job) CountRunning() (int64, error) {
}
func (p *Process) put() error {
if p.hasPut {
if p.hasPut || !p.running {
return nil
}
@ -235,6 +235,7 @@ func (p *Process) Stop() error {
if p == nil || !p.running {
return nil
}
p.running = false
if p.done != nil {
close(p.done)
@ -245,6 +246,6 @@ func (p *Process) Stop() error {
}
err := p.del()
p.running, p.hasPut = false, false
p.hasPut = false
return err
}