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

Added ratio limiter #193

Closed

Conversation

ashaychangwani
Copy link

I've added code to limit the upload/download ratio to exactly 1.0

It automatically archives the torrent and announces it to the tracker once it is being deleted.

In the next few commits, I'll write code to add a configuration parameter to set the ratio to a customizable level, while also giving the option to disable the ratio limiter.

If there's any issue with the current codebase changes, do let me know, and I'll consider them for the future commits as well!

@ashaychangwani ashaychangwani marked this pull request as ready for review February 10, 2023 20:46
@JourneyOver
Copy link
Contributor

JourneyOver commented Feb 14, 2023

Would love to see this get implented in @anthonyraymond would mean I could finally get rid of my script that auto deletes .torrent files after a certain amount of hours xD

also @ashaychangwani when you plan on getting the code added for the configuration parameter to set the ratio?

@ashaychangwani
Copy link
Author

also @ashaychangwani when you plan on getting the code added for the configuration parameter to set the ratio?

I'm working on it, but having some issues since the file structure is different between Joal and Joal-Desktop. I'm not good enough at front-end to reconcile them, but once I can figure that out, adding the parameters should be easy.

Another major issue I'm working on is that even though Joal seems like it's doing everything correctly (Announcing right before the torrent is deleted) after it's done seeding, many times that announcement is not captured by the indexer I use. I'm working on a new implementation that just sets the speed to 0 once it's done seeding, then when Joal completes it's automatic announce at 30 minutes, I'll delete the torrent from Joal.

@rursache
Copy link

@ashaychangwani please make the default to be "no ratio limit" to not break/change the behavior of existing setups! thanks

@ashaychangwani
Copy link
Author

ashaychangwani commented Feb 20, 2023

also @ashaychangwani when you plan on getting the code added for the configuration parameter to set the ratio?

Done.

@ashaychangwani please make the default to be "no ratio limit" to not break/change the behavior of existing setups! thanks

Done.

@anthonyraymond not sure how we proceed from here, but it seems like the expected functionality is achieved.

@anthonyraymond
Copy link
Owner

Hello, thanks for your PR 😄

I'm sorry i haven't looked at the code yet, i don't have much spare time these days.
have you looked at my comment at your issue: #191 (comment) ? Before i take a look at the code, can you tell me if the "check list" is completed?

@ashaychangwani
Copy link
Author

Sure!

  • Ensure the project still start even if the joal.conf does not contains the new entries
  • [-] Make the ratio-limit an object containing (bool enabled, int maxRatio), don't inline those two properties in the JoalConfig please.

I have taken a different approach, where the ratio is a float and -1 is set to infinity, and users can customize their ratio. By default (even when there is no entry in the config), it's set to -1.

  • Make it opt-in (off by default)
  • As is, the feature only work if the upload happen in a single session (ratio is not considered reach if a upload 50%, stop, upload the remaining 50%). Please add a side note to the UI config page.

Screenshot of settings page:
image

@anthonyraymond
Copy link
Owner

Hello there, i've not forgotten about you.

But i'm lacking time to review that. I try to give it a look ASAP

@JourneyOver
Copy link
Contributor

Any word on this by chance still getting a review and such? still would love to get this implemented at some point.

@anthonyraymond
Copy link
Owner

Hello @ashaychangwani,
Thanks for your PR, i've ended up coding the functionality in a different way (#221) because the current implementation had potential race conditions and some concurrent access that may have cause issues in rare but possible use cases.

However, i'll gladly accept a PR on the joal-ui project including what you've done to add the checkbox and API call.

@anthonyraymond
Copy link
Owner

Closed in favor of #221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Ratio limit to Joal is there a way to only seed until X ratio
4 participants