Improved the pauses between indexing steps and between files of the Batch Processing Assistant (#1240)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-27 14:39:17 +01:00
1 parent a117074972
commit 899139c88b
32 files changed
+787 -425

No files matched your search

@@ -0,0 +1,27 @@
namespace AIStudio.Tools.Pauses;
/// <summary>
/// The shortest and the longest pause a feature allows for either bound of its random pause, cf. PauseRange.
/// </summary>
/// <remarks>
/// Each feature sets its own limits next to its settings: the indexing allows no pause at all, for
/// example, while the batch processing always pauses for a few seconds.
/// </remarks>
/// <param name="ShortestSeconds">The shortest pause either bound may ask for.</param>
/// <param name="LongestSeconds">The longest pause either bound may ask for.</param>
public sealed record PauseLimits(int ShortestSeconds, int LongestSeconds)
{
/// <summary>
/// Whether a bound lies within the limits, e.g., one which a configuration plugin sets.
/// </summary>
/// <param name="seconds">The bound.</param>
/// <returns>True when the feature allows the bound.</returns>
public bool Allows(int seconds) => seconds >= this.ShortestSeconds && seconds <= this.LongestSeconds;
/// <summary>
/// Moves a bound into the limits.
/// </summary>
/// <param name="seconds">The bound.</param>
/// <returns>The bound, or the limit it went beyond.</returns>
public int Clamp(int seconds) => Math.Clamp(seconds, this.ShortestSeconds, this.LongestSeconds);
}