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