MCPcopy Create free account
hub / github.com/devfeel/dotweb / visit

Method visit

plugin.go:69–91  ·  view source on GitHub ↗
(path string, fileinfo os.FileInfo, err error)

Source from the content-addressed store, hash-verified

67}
68
69func (p *NotifyPlugin) visit(path string, fileinfo os.FileInfo, err error) error {
70 if err != nil {
71 return fmt.Errorf("访问文件失败%s", err)
72 }
73 ext := filepath.Ext(path)
74 if !fileinfo.IsDir() && (p.suffix[ext] || len(p.suffix) == 0) {
75 modTime := fileinfo.ModTime()
76 if oldModTime, ok := p.ModTimes[path]; !ok {
77 p.ModTimes[path] = modTime
78 } else {
79 if oldModTime.Before(modTime) {
80 p.app.Logger().Info("NotifyPlugin Reload "+path, LogTarget_HttpServer)
81 appConfig, err := config.InitConfig(p.app.Config.ConfigFilePath, p.app.Config.ConfigType)
82 if err != nil {
83 p.app.Logger().Error("NotifyPlugin Reload "+path+" error => "+fmt.Sprint(err), LogTarget_HttpServer)
84 }
85 p.app.ReSetConfig(appConfig)
86 p.ModTimes[path] = modTime
87 }
88 }
89 }
90 return nil
91}
92
93func (p *NotifyPlugin) start() error {
94 for {

Callers

nothing calls this directly

Calls 5

InitConfigFunction · 0.92
ReSetConfigMethod · 0.80
InfoMethod · 0.65
ErrorMethod · 0.65
LoggerMethod · 0.45

Tested by

no test coverage detected