From b17c286d0d012acdd3b2a9988bff40e768b1f2ce Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 24 Aug 2024 01:45:13 +0200 Subject: [PATCH] Fix server crash on shutdown due to DB notifications (#31379) Fixes #31365 --- Content.Server/Database/ServerDbPostgres.Notifications.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Content.Server/Database/ServerDbPostgres.Notifications.cs b/Content.Server/Database/ServerDbPostgres.Notifications.cs index fe358923bf0..69cf2c7d775 100644 --- a/Content.Server/Database/ServerDbPostgres.Notifications.cs +++ b/Content.Server/Database/ServerDbPostgres.Notifications.cs @@ -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) @@ -116,6 +118,5 @@ public override void Shutdown() return; _notificationConnection.Notification -= OnNotification; - _notificationConnection.Dispose(); } }