fix(threads): mark PendingMessage thread as background, document RetentionSweep rationale

This commit is contained in:
2026-05-07 00:54:43 +02:00
parent 079e280226
commit 8c624a0032
2 changed files with 14 additions and 1 deletions
+9 -1
View File
@@ -66,7 +66,15 @@ internal class MessageManager : IAsyncDisposable
Store = new MessageStore(DatabasePath());
PendingMessageThread = new Thread(() => ProcessPendingMessages(PendingThreadCancellationToken.Token));
// IsBackground = true so a stuck worker never blocks plugin unload.
// The worker has its own cancellation path via PendingThreadCancellationToken,
// and DisposeAsync waits up to 10s for cooperative shutdown. The
// background flag is the safety net for the case where cooperative
// shutdown fails to drain the queue in time.
PendingMessageThread = new Thread(() => ProcessPendingMessages(PendingThreadCancellationToken.Token))
{
IsBackground = true,
};
PendingMessageThread.Start();
ContentIdResolverHook = Plugin.GameInteropProvider.HookFromAddress<RaptureLogModule.Delegates.AddMsgSourceEntry>(RaptureLogModule.MemberFunctionPointers.AddMsgSourceEntry, ContentIdResolver);