feat: add storageEventListener nil check

Only shutdown the storageEventListener if the storageEventListener is not nil
This commit is contained in:
Elim Tsiagbey committed 2024-04-05 17:27:20 -04:00
1 parent fae2149990
commit a23c57e7c6
1 file changed
+5 -3
+5 -3
View File
@@ -712,9 +712,11 @@ func (w *Worker) Shutdown() error {
ar.SetAddresses(nil)
}
err := w.storageEventListener.Shutdown(w.baseContext)
if err != nil {
return fmt.Errorf("error shutting down worker event listener: %w", err)
if w.storageEventListener != nil {
err := w.storageEventListener.Shutdown(w.baseContext)
if err != nil {
return fmt.Errorf("error shutting down worker event listener: %w", err)
}
}
w.started.Store(false)