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

Delay subsequent requests to the same host #19801

Merged
merged 33 commits into from
Jan 19, 2024

Conversation

jNullj
Copy link
Contributor

@jNullj jNullj commented Oct 27, 2023

Closes #8350

This adds a delay between two network downloads to avoid hitting rate limits
The delay can be set in Preferences in the RSS tab.
Added both in native GUI and webUI.
I tested this manually on Linux and i did not detect any obvious issues.

Native GUI image of the new setting:
image

webUI image of the new setting:
image

Some other things to note which are not directly related:

  1. Please note that i found the webUI to have some bugs not related to this PR, i might PR fixes later, for example changing language, and some settings not getting default value in Preferences and more...
  2. Also while opening this PR i was redirected to CODING_GUIDELINES.md Which encourages me to use uncrustify, After running it i realized many files are not formatted by it, I might get a new PR that formats everything that's missing soon

This commit only adds the RSS fetch delay setting to gui and loads it to to RssSession

Part 1 for qbittorrent#8350
Add delay to requests with the same ServiceID
The delay length is based on RSS fetch delay

Fixes qbittorrent#8350
src/base/rss/rss_session.h Outdated Show resolved Hide resolved
src/base/rss/rss_session.h Outdated Show resolved Hide resolved
src/gui/optionsdialog.cpp Outdated Show resolved Hide resolved
src/webui/api/appcontroller.cpp Outdated Show resolved Hide resolved
src/webui/api/appcontroller.cpp Outdated Show resolved Hide resolved
src/base/rss/rss_session.cpp Outdated Show resolved Hide resolved
src/base/rss/rss_session.cpp Outdated Show resolved Hide resolved
src/webui/www/private/views/preferences.html Outdated Show resolved Hide resolved
src/base/rss/rss_session.cpp Outdated Show resolved Hide resolved
src/base/rss/rss_session.cpp Show resolved Hide resolved
@glassez glassez changed the title Feat: Requests delay for the same host Delay subsequent requests to the same host Oct 27, 2023
@glassez glassez self-assigned this Oct 27, 2023
src/base/net/downloadmanager.cpp Outdated Show resolved Hide resolved
@glassez
Copy link
Member

glassez commented Oct 27, 2023

while opening this PR i was redirected to CODING_GUIDELINES.md Which encourages me to use uncrustify,

Note that uncrustify does not guarantee full compliance with our coding style. Just read CODING_GUIDELINES.md and follow it in your code contribution.

@glassez glassez added RSS RSS-related issues/changes Core labels Oct 27, 2023
@luzpaz
Copy link
Contributor

luzpaz commented Nov 3, 2023

ping @jNullj

@jNullj
Copy link
Contributor Author

jNullj commented Nov 3, 2023

ping @jNullj

Thank you for the reminder, I may be able to fix the PR this sunday.

@ASTX111
Copy link

ASTX111 commented Nov 29, 2023

Any idea when this might be coming? It would be a great update to the appliacation! <3

@jNullj
Copy link
Contributor Author

jNullj commented Nov 29, 2023

Due to my new job, my GitHub activity has decreased. Apologies for delays. I'll aim to resume work this weekend. Feel free to co-commit or suggest changes. If maintainers feel the need to edit or create a separate PR due to my pace, I understand. Thanks for your patience.

jNullj and others added 7 commits December 2, 2023 21:10
Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
Delay is per ServiceID
This removes dependency of RSS_Session from downloadmanager.
Update delay for registered sequential download services.
User might change rss fetch delay.
This commit updates existing services with new values
to take instant effect for the change without the need for a restart.

Closes qbittorrent#8350
@jNullj
Copy link
Contributor Author

jNullj commented Dec 4, 2023

Updated the PR:
Resolved all suggestions by @Chocobo1 at 8510d96 to e1d5d28
I fixed the issue spotted by @glassez
Added code to update existing delay when the value is changed and merged latest master commits as well.

src/base/net/downloadmanager.cpp Outdated Show resolved Hide resolved
src/base/net/downloadmanager.cpp Outdated Show resolved Hide resolved
src/base/net/downloadmanager.cpp Outdated Show resolved Hide resolved
src/base/net/downloadmanager.cpp Outdated Show resolved Hide resolved
src/base/net/downloadmanager.h Outdated Show resolved Hide resolved
src/base/settingsstorage.h Outdated Show resolved Hide resolved
src/base/settingsstorage.h Outdated Show resolved Hide resolved
src/gui/optionsdialog.ui Outdated Show resolved Hide resolved
src/gui/optionsdialog.ui Outdated Show resolved Hide resolved
src/gui/optionsdialog.ui Outdated Show resolved Hide resolved
@glassez glassez requested a review from a team December 15, 2023 08:38
@glassez glassez added this to the 5.0 milestone Dec 15, 2023
jNullj and others added 3 commits December 15, 2023 11:41
Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
Co-authored-by: Vladimir Golovnev <glassez@yandex.ru>
Revert some unneeded changes to optionsdialog.ui
intrudoced at commit e79878a
This will make diff at merge more readable
glassez
glassez previously approved these changes Jan 6, 2024
@glassez glassez requested a review from a team January 6, 2024 14:53
Copy link
Member

@Chocobo1 Chocobo1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last comments from me

src/webui/api/appcontroller.cpp Outdated Show resolved Hide resolved
src/webui/api/appcontroller.cpp Outdated Show resolved Hide resolved
src/gui/optionsdialog.ui Outdated Show resolved Hide resolved
src/base/net/downloadmanager.cpp Outdated Show resolved Hide resolved
jNullj and others added 2 commits January 7, 2024 23:07
Change rss_fetch_delay from int to qlonglong to avoid clipping

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
Allow maximum value as user input to remove artificial limit

Co-authored-by: Chocobo1 <Chocobo1@users.noreply.github.com>
@glassez
Copy link
Member

glassez commented Jan 8, 2024

Unfortunately, I have found that these changes have "opened the door" to undefined behavior and/or race conditions. I want to make some preliminary changes in separate PR, and when it is merged, we will continue with this one.

@glassez
Copy link
Member

glassez commented Jan 11, 2024

I want to make some preliminary changes in separate PR

#20257

@glassez
Copy link
Member

glassez commented Jan 11, 2024

@jNullj
It looks like the place where you originally inserted the timer code was the best choice. The illogic that confused me was caused by the inappropriate naming of some things, so I corrected them in #20257. I added the timer code there in advance (with zero timeout), so all you have to do is add the code for setting the configured timeout.

@jNullj
Copy link
Contributor Author

jNullj commented Jan 12, 2024

No problem, i will update it after #20257 is merged to avoid reworking this pr if it changes before that.
I noticed you included a copyright notice update, should i add my (and co-authors) name/year in the files once i update them?

@glassez
Copy link
Member

glassez commented Jan 12, 2024

should i add my (and co-authors) name/year in the files once i update them?

Your - yes.
Are there any co-authors who have made significant contributions to it? Or do you mean those who offered some tips on correcting the coding style, etc.?

@jNullj
Copy link
Contributor Author

jNullj commented Jan 12, 2024

should i add my (and co-authors) name/year in the files once i update them?

Your - yes. Are there any co-authors who have made significant contributions to it? Or do you mean those who offered some tips on correcting the coding style, etc.?

Those who offered some tips on correcting the coding style, as in those who reviewed my code and offered changes.
All changes i made which you did not offer, I created myself.

@glassez
Copy link
Member

glassez commented Jan 12, 2024

Those who offered some tips on correcting the coding style, as in those who reviewed my code and offered changes.

If the proposed changes are trivial, such as correcting the coding style, then we do not take this into account as co-authorship.

@glassez
Copy link
Member

glassez commented Jan 13, 2024

@jNullj
#20257 has just merged.

Re-add download delay for same serviceID (same domain and port)
after the download manager refactor.
@jNullj jNullj requested a review from glassez January 13, 2024 20:29
@jNullj jNullj requested a review from glassez January 14, 2024 19:23
@glassez glassez requested a review from a team January 15, 2024 07:06
@glassez glassez merged commit c5d7b62 into qbittorrent:master Jan 19, 2024
13 checks passed
@glassez
Copy link
Member

glassez commented Jan 19, 2024

@jNullj
Thank you!

@HanabishiRecca
Copy link
Contributor

@glassez

Copy link
Contributor

@HanabishiRecca HanabishiRecca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I didn't publish the review.

src/webui/www/private/views/preferences.html Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core RSS RSS-related issues/changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rate Limit on RSS feeds
6 participants