Enhance proxy handling and error reporting in collection process
- Introduced a `Via` field in `ParseError` to indicate the proxy address used during requests, improving clarity on error contexts. - Updated `ProxyPool` to prioritize confirmed live proxies while available, ensuring more reliable proxy selection and reducing connection timeouts. - Implemented fallback logic to allow the use of unconfirmed proxies when no confirmed ones are available, preventing collection stalls. - Adjusted logging in `CollectLogEntryViewModel` to include proxy details, enhancing error visibility for users. - Added unit tests to verify new proxy selection logic and ensure correct behavior under various conditions. These changes improve the robustness of the proxy management system and enhance the overall user experience by providing clearer error messages and more efficient proxy usage.
This commit is contained in:
@@ -29,6 +29,14 @@ public sealed record ParseError(int Index, string Message)
|
||||
/// </remarks>
|
||||
public string? Subject { get; init; }
|
||||
|
||||
/// <summary>What the attempt went through — a proxy address — when it went through anything.</summary>
|
||||
/// <remarks>
|
||||
/// Worth carrying for the same reason as <see cref="Subject"/>: "the site answered 404" and "the
|
||||
/// request timed out" mean very different things depending on whether the pool handed out a proxy
|
||||
/// it had confirmed or one it had never spoken to, and without this the difference is invisible.
|
||||
/// </remarks>
|
||||
public string? Via { get; init; }
|
||||
|
||||
/// <summary>Creates an error carrying a translation code.</summary>
|
||||
public static ParseError Create(int index, string code, string message, params object?[] arguments) =>
|
||||
new(index, message) { Code = code, Arguments = arguments };
|
||||
|
||||
Reference in New Issue
Block a user