fixed startup crash for file provider

This commit is contained in:
yusing
2024-09-21 17:22:17 +08:00
parent a29bf880bc
commit 26e2154c64
6 changed files with 29 additions and 18 deletions

View File

@@ -20,11 +20,10 @@ func NewFileWatcher(filename string) Watcher {
}
func (f *fileWatcher) Events(ctx context.Context) (<-chan Event, <-chan E.NestedError) {
if fwHelper == nil {
fwHelper = newFileWatcherHelper(common.ConfigBasePath)
}
return fwHelper.Add(ctx, f)
}
func InitFileWatcherHelper() {
fwHelper = newFileWatcherHelper(common.ConfigBasePath)
}
var fwHelper *fileWatcherHelper