mirror of
https://github.com/InazumaV/Ratte.git
synced 2026-02-04 04:30:09 +00:00
fix watcher
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"Ratte/common/watcher"
|
||||
"errors"
|
||||
"fmt"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"path"
|
||||
)
|
||||
|
||||
@@ -31,9 +32,14 @@ func (c *Conf) SetErrorHandler(w ErrorHandler) {
|
||||
}
|
||||
|
||||
func (c *Conf) Watch() error {
|
||||
if c.watcherHandle != nil {
|
||||
if c.watcherHandle == nil {
|
||||
return errors.New("no watch handler")
|
||||
}
|
||||
if c.errorHandler == nil {
|
||||
c.errorHandler = func(err error) {
|
||||
log.WithField("service", "conf_watcher").Error(err)
|
||||
}
|
||||
}
|
||||
if IsHttpUrl(c.path) {
|
||||
if c.Watcher.WatchRemoteConfig {
|
||||
w := watcher.NewHTTPWatcher(c.path, c.Watcher.RemoteInterval)
|
||||
|
||||
Reference in New Issue
Block a user