feat: add conditional piece content reading based on need_piece_content flag #1296
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces improved error handling and logging throughout the codebase, making it easier to diagnose and track down issues related to invalid parameters and missing data. Additionally, it adds a new feature to optionally include piece content when handling tasks. The most important changes are grouped below:
Error Handling and Logging Improvements:
error!
macro in multiple locations where invalid parameters or missing fields are detected, such as missing headers, invalid addresses, missing persistent cache fields, and missing or invalid resource pieces. This provides clearer diagnostics for debugging and operational monitoring. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14]error
macro fromtracing
where needed.Task and Piece Handling Enhancements:
need_piece_content
boolean parameter to theTask
struct and related logic, allowing tasks to optionally fetch and include piece content from local storage. This is useful for scenarios where the content is required for further processing. [1] [2]need_piece_content
is set, including error handling for read failures.These changes collectively improve the robustness and observability of the code, especially in error scenarios, and add flexibility in how task pieces are managed.
Related Issue
Motivation and Context
Screenshots (if appropriate)