Skip to content

Commit

Permalink
perf: scan files at first when source start (#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
YenchangChan committed Mar 15, 2024
1 parent b6f758b commit f27f8d3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/source/file/watch.go
Expand Up @@ -18,12 +18,13 @@ package file

import (
"fmt"
"github.com/loggie-io/loggie/pkg/util/persistence/reg"
"os"
"path/filepath"
"sync"
"time"

"github.com/loggie-io/loggie/pkg/util/persistence/reg"

"github.com/fsnotify/fsnotify"
"github.com/loggie-io/loggie/pkg/core/log"
"github.com/loggie-io/loggie/pkg/discovery/kubernetes/external"
Expand Down Expand Up @@ -726,6 +727,9 @@ func (w *Watcher) run() {
case <-w.done:
return
case watchTaskEvent := <-w.watchTaskEventChan:
if watchTaskEvent.watchTaskType == START {
w.scanNewFiles()
}
w.handleWatchTaskEvent(watchTaskEvent)
case job := <-w.zombieJobChan:
w.decideZombieJob(job)
Expand Down

0 comments on commit f27f8d3

Please sign in to comment.