Skip to content

feat(dragonfly-client): replace inspect_err with unwrap_or_else for error handling in piece download requests #1148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025

Conversation

gaius-qi
Copy link
Member

Description

This pull request replaces the use of .inspect_err with .unwrap_or_else in multiple locations across the PersistentCacheTask and Task implementations. This change ensures that errors are handled explicitly without propagating them further, improving error handling and making the code more robust.

Changes in PersistentCacheTask (dragonfly-client/src/resource/persistent_cache_task.rs):

  • Replaced .inspect_err with .unwrap_or_else to handle errors when sending DownloadPieceFinishedRequest and DownloadPieceFinishedResponse, ensuring errors are logged and the interrupt flag is set appropriately. [1] [2] [3]

Changes in Task (dragonfly-client/src/resource/task.rs):

  • Updated .inspect_err to .unwrap_or_else for error handling when sending DownloadPieceFinishedRequest, DownloadPieceFinishedResponse, and DownloadPieceBackToSourceFinishedRequest. This ensures errors are logged and handled explicitly without propagating them further. [1] [2] [3] [4] [5] [6]

Related Issue

Motivation and Context

Screenshots (if appropriate)

@gaius-qi gaius-qi added this to the v2.3.0 milestone May 13, 2025
@gaius-qi gaius-qi self-assigned this May 13, 2025
@gaius-qi gaius-qi added the enhancement New feature or request label May 13, 2025
@gaius-qi gaius-qi requested a review from a team as a code owner May 13, 2025 15:05
@github-actions github-actions bot requested a review from yxxhero May 13, 2025 15:05
…rror handling in piece download requests

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi force-pushed the feature/remove-error branch from 62cf1f7 to 0fc1d32 Compare May 13, 2025 15:06
Copy link
Contributor

@Liam-Zhao Liam-Zhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Liam-Zhao Liam-Zhao enabled auto-merge (squash) May 13, 2025 15:17
@Liam-Zhao Liam-Zhao merged commit f8ae582 into main May 13, 2025
7 checks passed
@Liam-Zhao Liam-Zhao deleted the feature/remove-error branch May 13, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants