fix error when add stream
This commit is contained in:
parent
5e55d86e7e
commit
18da2c1372
|
@ -10,15 +10,10 @@ import (
|
|||
// AddStream add new stream, with default config
|
||||
func AddStream(name string, subjects []string) error {
|
||||
// Get info about the stream
|
||||
stream, err := natsJS.StreamInfo(name)
|
||||
if err != nil {
|
||||
msg := fmt.Sprintf("error getting stream info: %s", err.Error())
|
||||
return errors.New(msg)
|
||||
}
|
||||
|
||||
stream, _ := natsJS.StreamInfo(name)
|
||||
// If stream not found, create new
|
||||
if stream == nil {
|
||||
_, err = natsJS.AddStream(&nats.StreamConfig{
|
||||
_, err := natsJS.AddStream(&nats.StreamConfig{
|
||||
Name: name,
|
||||
Subjects: subjects,
|
||||
Storage: nats.FileStorage,
|
||||
|
|
Loading…
Reference in New Issue