Delay subsequent requests to the same host

PR #19801.
Closes #8350.
This commit is contained in:
jNullj 2024-01-19 19:38:16 +02:00 committed by GitHub
parent 8ec3db1807
commit c5d7b62473
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 98 additions and 10 deletions

View file

@ -1,5 +1,6 @@
/*
* Bittorrent Client using Qt and libtorrent.
* Copyright (C) 2024 Jonathan Ketchker
* Copyright (C) 2017 Vladimir Golovnev <glassez@yandex.ru>
* Copyright (C) 2010 Christophe Dumez <chris@qbittorrent.org>
* Copyright (C) 2010 Arnaud Demaiziere <arnaud@qbittorrent.org>
@ -62,6 +63,7 @@ QPointer<Session> Session::m_instance = nullptr;
Session::Session()
: m_storeProcessingEnabled(u"RSS/Session/EnableProcessing"_s)
, m_storeRefreshInterval(u"RSS/Session/RefreshInterval"_s, 30)
, m_storeFetchDelay(u"RSS/Session/FetchDelay"_s, 2)
, m_storeMaxArticlesPerFeed(u"RSS/Session/MaxArticlesPerFeed"_s, 50)
, m_workingThread(new QThread)
{
@ -525,6 +527,19 @@ void Session::setRefreshInterval(const int refreshInterval)
}
}
std::chrono::seconds Session::fetchDelay() const
{
return std::chrono::seconds(m_storeFetchDelay);
}
void Session::setFetchDelay(const std::chrono::seconds delay)
{
if (delay == fetchDelay())
return;
m_storeFetchDelay = static_cast<qint64>(delay.count());
rootFolder()->updateFetchDelay();
}
QThread *Session::workingThread() const
{
return m_workingThread.get();