Skip to content

Commit

Permalink
cherry-pick "Fix server crash on shutdown due to DB notifications" (#…
Browse files Browse the repository at this point in the history
…31379) (#2057)

Fix server crash on shutdown due to DB notifications (#31379)

Fixes #31365

Co-authored-by: Pieter-Jan Briers <[email protected]>
  • Loading branch information
MilonPL and PJB3005 authored Oct 27, 2024
1 parent 3a1fa0b commit c8309ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Content.Server/Database/ServerDbPostgres.Notifications.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ private async Task NotificationListener(CancellationToken cancellationToken)
_notifyLog.Error($"Error in notification listener: {e}");
}
}

_notificationConnection.Dispose();
}

private void OnNotification(object _, NpgsqlNotificationEventArgs notification)
Expand All @@ -116,6 +118,5 @@ public override void Shutdown()
return;

_notificationConnection.Notification -= OnNotification;
_notificationConnection.Dispose();
}
}

0 comments on commit c8309ee

Please sign in to comment.