Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic when closing nats connection #4016

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-panic-nats-close.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Fix panic when closing notification service

If the connection to the nats server was not yet estabished,
the service on close was panicking. This has been now fixed.

https://github.com/cs3org/reva/pull/4016
4 changes: 4 additions & 0 deletions pkg/notification/notificationhelper/notificationhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (nh *NotificationHelper) connect() error {

// Stop stops the notification helper.
func (nh *NotificationHelper) Stop() {
if nh.nc == nil {
// service didn't connect yet to nat server
return
}
if err := nh.nc.Drain(); err != nil {
nh.Log.Error().Err(err)
}
Expand Down