initialize streaming events without lazy initialization (#16016)

This commit is contained in:
Harshavardhana
2022-11-07 08:01:24 -08:00
committed by GitHub
parent 1f3db03bf0
commit 21251d8c22
10 changed files with 81 additions and 51 deletions
+8 -5
View File
@@ -410,9 +410,6 @@ func (target *NATSTarget) initNATS() error {
return errNotConnected
}
if target.store != nil {
streamEventsFromStore(target.store, target, target.quitCh, target.loggerOnce)
}
return nil
}
@@ -427,11 +424,17 @@ func NewNATSTarget(id string, args NATSArgs, loggerOnce logger.LogOnce) (*NATSTa
}
}
return &NATSTarget{
target := &NATSTarget{
id: event.TargetID{ID: id, Name: "nats"},
args: args,
loggerOnce: loggerOnce,
store: store,
quitCh: make(chan struct{}),
}, nil
}
if target.store != nil {
streamEventsFromStore(target.store, target, target.quitCh, target.loggerOnce)
}
return target, nil
}