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 {
|
for _, f := range files {
|
||||||
p := directory.Path + "/" + f.Name()
|
p := directory.Path + "/" + f.Name()
|
||||||
if directory._regex == nil || directory._regex.MatchString(p) {
|
if directory._regex == nil || directory._regex.MatchString(p) {
|
||||||
pollI := pollInfo{
|
if time.Now().Add(-1 * time.Minute).After(f.ModTime()) {
|
||||||
path: p,
|
pollI := pollInfo{
|
||||||
event: 0,
|
path: p,
|
||||||
}
|
event: 0,
|
||||||
select {
|
}
|
||||||
case c <- pollI:
|
select {
|
||||||
default:
|
case c <- pollI:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Printf("[ INFO ] path=\"%s\" polling=\"true\" info=\"ignoring, too young\"\n", p)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Printf("[ INFO ] path=\"%s\" polling=\"true\" info=\"no regex match\"\n", p)
|
log.Printf("[ INFO ] path=\"%s\" polling=\"true\" info=\"no regex match\"\n", p)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user