remove a redundant goroutine

This commit is contained in:
Sridhar Ratnakumar 2013-05-27 15:41:33 -07:00
parent ec461b87f0
commit 1336a0e4ab
1 changed files with 2 additions and 15 deletions

View File

@ -120,10 +120,10 @@ func (fw *PollingFileWatcher) ChangeEvents(origFi os.FileInfo) chan bool {
ch := make(chan bool) ch := make(chan bool)
stop := make(chan bool) stop := make(chan bool)
var once sync.Once var once sync.Once
every2Seconds := time.Tick(2 * time.Second)
var prevModTime time.Time var prevModTime time.Time
// XXX: use tomb.Tomb to cleanly managed these goroutines. // XXX: use tomb.Tomb to cleanly manage these goroutines. replace
// the panic (below) with tomb's Kill.
stopAndClose := func() { stopAndClose := func() {
go func() { go func() {
@ -169,19 +169,6 @@ func (fw *PollingFileWatcher) ChangeEvents(origFi os.FileInfo) chan bool {
} }
}() }()
go func() {
for {
select {
case <-every2Seconds:
// XXX: not using file descriptor as per contract.
if _, err := os.Stat(fw.Filename); os.IsNotExist(err) {
once.Do(stopAndClose)
return
}
}
}
}()
return ch return ch
} }