[PR #22] [CLOSED] Update progress_object.rs to add thread safe calculations #116

Closed
opened 2026-02-17 17:12:08 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Drop-OSS/drop-app/pull/22
Author: @AdenMGB
Created: 1/9/2025
Status: Closed

Base: developHead: patch-1


📝 Commits (1)

  • cb6df37 Update progress_object.rs to add thread safe calculations

📊 Changes

1 file changed (+68 additions, -11 deletions)

View changed files

📝 src-tauri/src/download_manager/progress_object.rs (+68 -11)

📄 Description

Add Rolling Progress Averages for Download Statistics

Changes

  • Implemented a new ProgressSamples struct to track download speed using a rolling window
  • Added thread-safe sample collection using VecDeque with a configurable window size
  • Improved speed calculation accuracy by using averaged samples instead of instantaneous measurements
  • Enhanced time remaining calculations to be more stable and avoid fluctuations

Details

  • Uses a 10-second rolling window for speed calculations
  • Thread-safe implementation using Arc<Mutex<>>
  • Proper handling of edge cases (zero speed, insufficient samples)
  • Cleaner conversion between bytes and kilobytes
  • More accurate time remaining calculation by avoiding unnecessary max(1) calls

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Drop-OSS/drop-app/pull/22 **Author:** [@AdenMGB](https://github.com/AdenMGB) **Created:** 1/9/2025 **Status:** ❌ Closed **Base:** `develop` ← **Head:** `patch-1` --- ### 📝 Commits (1) - [`cb6df37`](https://github.com/Drop-OSS/drop-app/commit/cb6df37171f9a4ed90d76525fd0bde027ef5e04f) Update progress_object.rs to add thread safe calculations ### 📊 Changes **1 file changed** (+68 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src-tauri/src/download_manager/progress_object.rs` (+68 -11) </details> ### 📄 Description ### Add Rolling Progress Averages for Download Statistics **_Changes_** - Implemented a new ProgressSamples struct to track download speed using a rolling window - Added thread-safe sample collection using VecDeque with a configurable window size - Improved speed calculation accuracy by using averaged samples instead of instantaneous measurements - Enhanced time remaining calculations to be more stable and avoid fluctuations **_Details_** - Uses a 10-second rolling window for speed calculations - Thread-safe implementation using Arc<Mutex<>> - Proper handling of edge cases (zero speed, insufficient samples) - Cleaner conversion between bytes and kilobytes - More accurate time remaining calculation by avoiding unnecessary max(1) calls --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-17 17:12:08 -05:00
yindo closed this issue 2026-02-17 17:12:08 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Drop-OSS/drop-app#116