Skip to content

Commit

Permalink
fix: change function name
Browse files Browse the repository at this point in the history
  • Loading branch information
kianaza committed Jun 29, 2024
1 parent 2a4fe84 commit f41f226
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/natsclient/jetstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewJetstream(config Config, logger *zap.Logger) *Jetstream {

j.createJetstreamContext()

j.createStream()
j.UpdateOrCreateStream()

Check warning on line 44 in internal/natsclient/jetstream.go

View check run for this annotation

Codecov / codecov/patch

internal/natsclient/jetstream.go#L44

Added line #L44 was not covered by tests

return j
}
Expand Down Expand Up @@ -72,13 +72,13 @@ func (j *Jetstream) createJetstreamContext() {
}
}

func (j *Jetstream) createStream() {
func (j *Jetstream) UpdateOrCreateStream() {
for _, stream := range j.config.Streams {
info, err := j.jetstream.StreamInfo(stream.Name)
if err == nil {
j.updateStream(stream, info)
} else if err == nats.ErrStreamNotFound && j.config.NewStreamAllow {
j.addStream(stream)
j.createStream(stream)
} else {
j.logger.Panic("could not add subject", zap.Error(err))

Check warning on line 83 in internal/natsclient/jetstream.go

View check run for this annotation

Codecov / codecov/patch

internal/natsclient/jetstream.go#L75-L83

Added lines #L75 - L83 were not covered by tests
}
Expand All @@ -98,7 +98,7 @@ func (j *Jetstream) updateStream(stream Stream, info *nats.StreamInfo) {
j.logger.Info("stream updated")

Check warning on line 98 in internal/natsclient/jetstream.go

View check run for this annotation

Codecov / codecov/patch

internal/natsclient/jetstream.go#L98

Added line #L98 was not covered by tests
}

func (j *Jetstream) addStream(stream Stream) {
func (j *Jetstream) createStream(stream Stream) {
_, err := j.jetstream.AddStream(&nats.StreamConfig{
Name: stream.Name,
Subjects: []string{stream.Subject},
Expand Down

0 comments on commit f41f226

Please sign in to comment.