Skip to content
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

Fix item_rank(), torrent_rank(), freshness_rank() functions #7338

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

kozlovsky
Copy link
Contributor

@kozlovsky kozlovsky commented Mar 28, 2023

As it turns out there is a minor issue in the logic of the item_rank(), torrent_rank(), and freshness_rank() functions.

The crux of the problem lies in how torrents with an unspecified creation date were handled. These torrents were treated as if they were created at the Unix epoch, 1970-01-01 00:00:00. Consequently, their freshness rank was marginally above zero and gradually decreased as their assumed "creation date" grew more distant. This led to unstable results in the test_item_rank, as the rank values were not constant but slowly diminishing.

To resolve this issue, this PR implements a fix that ensures the freshness rank, as well as the freshness component of the composite torrent rank, is strictly zero for all torrents with unknown or invalid creation dates. This adjustment has stabilized the tests and provided more accurate results.

@kozlovsky kozlovsky marked this pull request as ready for review March 28, 2023 15:33
@kozlovsky kozlovsky requested review from a team, drew2a and xoriole and removed request for a team March 28, 2023 15:33
@kozlovsky kozlovsky merged commit a702f4a into Tribler:release/7.13 Mar 28, 2023
@kozlovsky kozlovsky deleted the fix/test_item_rank branch March 28, 2023 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants