Skip to content

Commit

Permalink
Fix panic when closing nats connection (#4016)
Browse files Browse the repository at this point in the history
* fix panic when closing nats connection

* add changelog
  • Loading branch information
gmgigi96 authored Jun 28, 2023
1 parent ba3d5b1 commit 63cd6aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
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

0 comments on commit 63cd6aa

Please sign in to comment.