Skip to content

Conversation

gaius-qi
Copy link
Member

Description

This pull request refactors the client management logic in piece_downloader.rs to streamline how client entries are retrieved and used, and adjusts the idle timeout and logging for client cleanup. The main changes focus on simplifying client entry access, improving code clarity, and making idle client cleanup more visible.

Client management and code simplification:

  • Renamed the client method to client_entry and updated its return type to return the full DfdaemonUploadClientEntry instead of just the client, consolidating client retrieval logic and removing the now-unnecessary get_client_entry method. [1] [2]
  • Updated all usages to work directly with client_entry, simplifying the code by removing redundant client lookups and ensuring only a single path to retrieve a client entry. [1] [2] [3]

Timeout and logging improvements:

  • Increased the default downloader idle timeout from 30 seconds to 420 seconds to allow clients to remain active longer before being considered idle.
  • Changed the log level from debug! to info! when removing idle clients, making these events more visible in logs.

Related Issue

Motivation and Context

Screenshots (if appropriate)

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi added this to the v2.4.0 milestone Aug 26, 2025
@gaius-qi gaius-qi self-assigned this Aug 26, 2025
@gaius-qi gaius-qi added the enhancement New feature or request label Aug 26, 2025
Signed-off-by: Gaius <gaius.qi@gmail.com>
Copy link
Contributor

@LunaWhispers LunaWhispers left a comment

Choose a reason for hiding this comment

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

lgtm

@LunaWhispers LunaWhispers enabled auto-merge (squash) August 26, 2025 09:46
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

@LunaWhispers LunaWhispers merged commit 31bb98f into main Aug 26, 2025
8 of 9 checks passed
@LunaWhispers LunaWhispers deleted the feature/client-entry branch August 26, 2025 10:05
Copy link

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.63%. Comparing base (933c8f7) to head (66bb5f1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
dragonfly-client/src/resource/piece_downloader.rs 0.00% 10 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1311      +/-   ##
==========================================
+ Coverage   48.59%   48.63%   +0.03%     
==========================================
  Files          60       60              
  Lines       15196    15186      -10     
==========================================
  Hits         7385     7385              
+ Misses       7811     7801      -10     
Files with missing lines Coverage Δ
dragonfly-client/src/resource/piece_downloader.rs 10.88% <0.00%> (+0.53%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

4 participants