polling, ignore young files
This commit is contained in:
4
main.go
4
main.go
@@ -196,6 +196,7 @@ 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) {
|
||||||
|
if time.Now().Add(-1 * time.Minute).After(f.ModTime()) {
|
||||||
pollI := pollInfo{
|
pollI := pollInfo{
|
||||||
path: p,
|
path: p,
|
||||||
event: 0,
|
event: 0,
|
||||||
@@ -204,6 +205,9 @@ func startWatcher(directory *DirectoryConfig) {
|
|||||||
case c <- pollI:
|
case c <- pollI:
|
||||||
default:
|
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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user