Fixed the .NET server shutting down while the runtime still runs (#1237)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-26 12:01:08 +01:00
1 parent 9ebfce3855
commit 902e406e1d
22 files changed
+923 -115

No files matched your search

@@ -0,0 +1,30 @@
namespace AIStudio.Tools.Services.Indexing;
/// <summary>
/// The file system changes of one data source which WatcherChangeTally counted instead of logging each.
/// </summary>
/// <param name="Ignored">How many changes concerned no file of the RAG index.</param>
/// <param name="Relevant">How many changes concerned the RAG index.</param>
/// <param name="LastPath">The path of the last change, or an empty string without any.</param>
internal readonly record struct WatcherChangeCounts(int Ignored, int Relevant, string LastPath)
{
/// <summary>
/// No change counted.
/// </summary>
public static readonly WatcherChangeCounts NONE = new(0, 0, string.Empty);
/// <summary>
/// How many changes were counted.
/// </summary>
public int Total => this.Ignored + this.Relevant;
/// <summary>
/// Counts one more change.
/// </summary>
/// <param name="path">The path of the change.</param>
/// <param name="isRelevant">Whether the change concerns the RAG index.</param>
/// <returns>The counts including this change.</returns>
public WatcherChangeCounts Add(string path, bool isRelevant) => isRelevant
? this with { Relevant = this.Relevant + 1, LastPath = path }
: this with { Ignored = this.Ignored + 1, LastPath = path };
}