Skip to content

Commit

Permalink
Fix server crash on shutdown due to DB notifications (#31379)
Browse files Browse the repository at this point in the history
Fixes #31365
  • Loading branch information
PJB3005 authored and sleepyyapril committed Jan 14, 2025
1 parent 3f2d7b4 commit d9ebd28
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 d9ebd28

Please sign in to comment.