Remove Close method from FileChanges
This method will never do what we want, closing the channels will always signal receivers, which will confuse them.
This commit is contained in:
parent
068b72961a
commit
0587510d19
|
@ -23,12 +23,6 @@ func (fc *FileChanges) NotifyDeleted() {
|
||||||
sendOnlyIfEmpty(fc.Deleted)
|
sendOnlyIfEmpty(fc.Deleted)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fc *FileChanges) Close() {
|
|
||||||
close(fc.Modified)
|
|
||||||
close(fc.Truncated)
|
|
||||||
close(fc.Deleted)
|
|
||||||
}
|
|
||||||
|
|
||||||
// sendOnlyIfEmpty sends on a bool channel only if the channel has no
|
// sendOnlyIfEmpty sends on a bool channel only if the channel has no
|
||||||
// backlog to be read by other goroutines. This concurrency pattern
|
// backlog to be read by other goroutines. This concurrency pattern
|
||||||
// can be used to notify other goroutines if and only if they are
|
// can be used to notify other goroutines if and only if they are
|
||||||
|
|
|
@ -77,7 +77,6 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, fi os.FileInfo) *FileCh
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer inotifyTracker.CloseWatcher(w)
|
defer inotifyTracker.CloseWatcher(w)
|
||||||
defer changes.Close()
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
prevSize := fw.Size
|
prevSize := fw.Size
|
||||||
|
|
|
@ -49,8 +49,6 @@ func (fw *PollingFileWatcher) ChangeEvents(t *tomb.Tomb, origFi os.FileInfo) *Fi
|
||||||
fw.Size = origFi.Size()
|
fw.Size = origFi.Size()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer changes.Close()
|
|
||||||
|
|
||||||
var retry int = 0
|
var retry int = 0
|
||||||
|
|
||||||
prevSize := fw.Size
|
prevSize := fw.Size
|
||||||
|
|
Loading…
Reference in New Issue