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

Feature request: config file #41

Closed
rinchen opened this issue Apr 25, 2023 · 3 comments
Closed

Feature request: config file #41

rinchen opened this issue Apr 25, 2023 · 3 comments
Assignees

Comments

@rinchen
Copy link

rinchen commented Apr 25, 2023

Hi,

I've run into a situation where perhaps a configuration file for rate-mirrors would be helpful.

The current currency default is 8 and that works well for users on slower internet connections. For those on higher speed connections, a setting of 16 works much better.

Several Arch-based distributions use rate-mirrors as part of their update scripts. Some use the default concurrency setting and some override it.

It would be nice to have a configuration file to set the concurrency parameter in so that these tools can be extended to allow end-users to specify their internet speeds. These tools could then be extended to support the pacman.conf parallel option as well. Here is an example:

Slow:
concurrency = 4
parallel = 2

Default:
concurrency = 8
parallel = 5

Fast:
concurrency = 16
parallel = 10

What are your thoughts on adding this feature into rate-mirrors?

Thanks.

@westandskif
Copy link
Owner

Thank you, it's a good idea! I'll do it but probably won't get to it in the next 2-3 weeks.

@westandskif westandskif self-assigned this Apr 26, 2023
@westandskif
Copy link
Owner

westandskif commented Jun 16, 2023

my bad - I've been a bit out of mana :) I hope to get down to it soon

@westandskif
Copy link
Owner

hi @rinchen
I reviewed what can be done without breaking the current approach, which is "bare binary with its baked-in defaults should work everywhere" (no configs are needed). There is a problem with building configuration hierarchy like this:

  1. baked-in defaults
  2. optional config file
  3. CLI args (some of them are optional, some of them are not -- like subcommands).

Even though there are tools, which can simplify such config stacking, it would still require at least 2 copies of each config and a decent amount of copy-paste for each of 10 existing subcommands. I made a couple of attempts to approach it, but failed to come up with a nice way of doing it, that's why I changed the end goal.

As a simpler option, it may be less convenient though, I added environment variable support, so you can add export RATE_MIRRORS_CONCURRENCY=16 to your bashrc / zshrc file to pass this parameter unless the distro of your choice explicitly passes concurrency param (if so, CLI arg has the highest priority).

HOWEVER, along with the above, I changed rate-mirrors defaults so it now has concurrency=16 (better for fast connections), increased per-mirror timeouts (required for slow connections) and introduced upper limit for per-mirror download time (this speeds up tests if connection times are good).
Please, check out v0.16, it should become better at its "defaults should work for everyone".

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

No branches or pull requests

2 participants