Improve resource disposal practices

Wraps enumerators and commands in proper using blocks to ensure cleanup.
Adds async disposal for enumerators, reducing resource leakage risks.
This commit is contained in:
Darnell Williams
2025-05-29 15:04:17 -05:00
parent 3951c49e1a
commit 2cfd1b1487
4 changed files with 32 additions and 15 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ internal class MessageManager : IAsyncDisposable
if (!Plugin.Config.FilterIncludePreviousSessions)
since = Plugin.GameStarted;
var messages = Store.GetMostRecentMessages(CurrentContentId, since);
using var messages = Store.GetMostRecentMessages(CurrentContentId, since);
// We store the pending messages to be added to the chat log in a
// temporary list, and apply them all at once after filtering.