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
|
// AddStream add new stream, with default config
|
||||||
func AddStream(name string, subjects []string) error {
|
func AddStream(name string, subjects []string) error {
|
||||||
// Get info about the stream
|
// Get info about the stream
|
||||||
stream, err := natsJS.StreamInfo(name)
|
stream, _ := natsJS.StreamInfo(name)
|
||||||
if err != nil {
|
|
||||||
msg := fmt.Sprintf("error getting stream info: %s", err.Error())
|
|
||||||
return errors.New(msg)
|
|
||||||
}
|
|
||||||
|
|
||||||
// If stream not found, create new
|
// If stream not found, create new
|
||||||
if stream == nil {
|
if stream == nil {
|
||||||
_, err = natsJS.AddStream(&nats.StreamConfig{
|
_, err := natsJS.AddStream(&nats.StreamConfig{
|
||||||
Name: name,
|
Name: name,
|
||||||
Subjects: subjects,
|
Subjects: subjects,
|
||||||
Storage: nats.FileStorage,
|
Storage: nats.FileStorage,
|
||||||
|
|
Loading…
Reference in New Issue