fix race condition

This commit is contained in:
aler9 2020-09-03 16:31:52 +02:00
parent f40f3a34ab
commit 4afe8428c8
2 changed files with 3 additions and 3 deletions

View File

@ -59,7 +59,7 @@ func (pa *path) log(format string, args ...interface{}) {
func (pa *path) onInit() {
if pa.source != nil {
go pa.source.run()
go pa.source.run(pa.source.state)
}
if pa.confp.RunOnInit != "" {

View File

@ -66,8 +66,8 @@ func newSource(p *program, path *path, confp *confPath) *source {
func (s *source) isPublisher() {}
func (s *source) run() {
s.applyState(s.state)
func (s *source) run(initialState sourceState) {
s.applyState(initialState)
outer:
for {