summaryrefslogtreecommitdiff
path: root/service/reload
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-02-21 13:52:49 +0300
committerValery Piashchynski <[email protected]>2020-02-21 13:52:49 +0300
commita835127776e5f4c12cce68fdbac8e43684b0ca6d (patch)
tree652b2853893b2293b5fbf2daeea244608698dc49 /service/reload
parent7e522cf71c9eac90149ed513487d65f23b6a28b6 (diff)
Fix misconfiguration
Diffstat (limited to 'service/reload')
-rw-r--r--service/reload/config.go3
-rw-r--r--service/reload/service.go11
2 files changed, 7 insertions, 7 deletions
diff --git a/service/reload/config.go b/service/reload/config.go
index af1c79eb..551fb71b 100644
--- a/service/reload/config.go
+++ b/service/reload/config.go
@@ -41,7 +41,6 @@ func (c *Config) Hydrate(cfg service.Config) error {
// InitDefaults sets missing values to their default values.
func (c *Config) InitDefaults() error {
- //c.Interval = time.Second
-
+ c.Enabled = false
return nil
}
diff --git a/service/reload/service.go b/service/reload/service.go
index 12b157ab..461f9430 100644
--- a/service/reload/service.go
+++ b/service/reload/service.go
@@ -60,7 +60,7 @@ func (s *Service) Init(cfg *Config, c service.Container) (bool, error) {
},
files: make(map[string]os.FileInfo),
ignored: ConvertIgnored(wd, config.Ignore),
- filePatterns: config.Patterns,
+ filePatterns: append(config.Patterns, cfg.Patterns...),
})
}
@@ -76,6 +76,11 @@ func (s *Service) Serve() error {
if !s.reloadConfig.Enabled {
return nil
}
+
+ if s.reloadConfig.Interval < time.Second {
+ return errors.New("reload interval is too fast")
+ }
+
go func() {
for {
select {
@@ -99,10 +104,6 @@ func (s *Service) Serve() error {
}
}()
- if s.reloadConfig.Interval < time.Second {
- return errors.New("too fast")
- }
-
err := s.watcher.StartPolling(s.reloadConfig.Interval)
if err != nil {
return err