Skip to content

Fix wrong number of downloads when the tracker starts - #1509

Merged
josecelano merged 3 commits into
torrust:developfrom
josecelano:1502-overhaul-stats-import-downlodas-counters-at-start
May 8, 2025
Merged

josecelano merged 3 commits into
torrust:developfrom
josecelano:1502-overhaul-stats-import-downlodas-counters-at-start

Conversation

@josecelano

Copy link
Copy Markdown
Member

Relates to: #1502

As described here, when you start the tracker and stats persistence is enabled, you should see the last value for the number of downloads. Instead, you see something like this:

image

This PR fixes that problem.

It fixes the bug described in #1502. However, it does not fix other problems described in the issue (problem 3). I will open a new PR to fix problem 3.

josecelano added 2 commits May 8, 2025 16:42
There are no performance problems in dev env, so it's better to enable
as many features as possible to tests them while developing.
when the tracker starts.

In the current implementation all torrents that have benn downloaded at
least once have to be in memory initializting the counter. Otherwise,
the global counter for downloads for all torrents only includes
downloads for the torrents being currently tracker by the tracker.
@josecelano josecelano self-assigned this May 8, 2025
@josecelano josecelano added Bug Incorrect Behavior - User - Enjoyable to Use our Software labels May 8, 2025
@josecelano
josecelano requested a review from da2ce7 May 8, 2025 16:07
When possible prefer this with "variable=value" format:

```
imported_torrents=2
```

To this:

```
Imported torrents: 2
```

It's easier to parse and less likely to be changed.
@josecelano
josecelano force-pushed the 1502-overhaul-stats-import-downlodas-counters-at-start branch from 60eaed2 to 632185b Compare May 8, 2025 16:08
@josecelano

Copy link
Copy Markdown
Member Author

ACK 632185b

@josecelano

Copy link
Copy Markdown
Member Author

@codecov

codecov Bot commented May 8, 2025 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 83.85%. Comparing base (627d535) to head (632185b).
Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
src/app.rs 30.00% 5 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1509      +/-   ##
===========================================
- Coverage    83.90%   83.85%   -0.06%     
===========================================
  Files          257      257              
  Lines        17936    17946      +10     
  Branches     17936    17946      +10     
===========================================
- Hits         15050    15049       -1     
- Misses        2610     2620      +10     
- Partials       276      277       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@da2ce7

da2ce7 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Post-merge note: this pull request requested a review from this account and was closed without one at its final head. A post-merge review will not be done: The start-up loading of download counts it added was turned off by #1511 the next day and later removed in #1542, so its fix no longer runs on the default branch.

This branch was previously deployed

1 inactive deployment
coverage — 632185bf Deployed May 8, 2025 by josecelano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

- User - Enjoyable to Use our Software Bug Incorrect Behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants