summaryrefslogtreecommitdiff
path: root/service/reload/service.go
blob: db10b6f4163d774eed28e15ed3f4cc2b1b50d7ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package reload

import "github.com/spiral/roadrunner/service"

// ID contains default service name.
const ID = "reload"

type Service struct {
	reloadConfig *Config
}

// Init controller service
func (s *Service) Init(cfg *Config, c service.Container) (bool, error) {
	// mount Services to designated services
	//for id, watcher := range cfg.Controllers(s.throw) {
	//	svc, _ := c.Get(id)
	//	if ctrl, ok := svc.(controllable); ok {
	//		ctrl.Attach(watcher)
	//	}
	//}

	s.reloadConfig = cfg

	return true, nil
}

func (s *Service) Serve() error {
	w, err := NewWatcher(s.reloadConfig, SetMaxFileEvents(100))
	if err != nil {
		return err
	}

	_ = w

	return nil
}

func (s *Service) Stop() {

}