polling, ignore young files
This commit is contained in:
parent
5d52e3c35c
commit
50b1c7205d
18
main.go
18
main.go
@ -196,13 +196,17 @@ func startWatcher(directory *DirectoryConfig) {
|
||||
for _, f := range files {
|
||||
p := directory.Path + "/" + f.Name()
|
||||
if directory._regex == nil || directory._regex.MatchString(p) {
|
||||
pollI := pollInfo{
|
||||
path: p,
|
||||
event: 0,
|
||||
}
|
||||
select {
|
||||
case c <- pollI:
|
||||
default:
|
||||
if time.Now().Add(-1 * time.Minute).After(f.ModTime()) {
|
||||
pollI := pollInfo{
|
||||
path: p,
|
||||
event: 0,
|
||||
}
|
||||
select {
|
||||
case c <- pollI:
|
||||
default:
|
||||
}
|
||||
} else {
|
||||
log.Printf("[ INFO ] path=\"%s\" polling=\"true\" info=\"ignoring, too young\"\n", p)
|
||||
}
|
||||
} else {
|
||||
log.Printf("[ INFO ] path=\"%s\" polling=\"true\" info=\"no regex match\"\n", p)
|
||||
|
Loading…
Reference in New Issue
Block a user