mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-31 03:50:20 -07:00
Restore BitTorrent session asynchronously
Reduce the total startup time of the application and maintain sufficient responsiveness of the UI during startup due to the following: 1. Load resume data from disk asynchronously in separate thread; 2. Split handling of loaded resume data in chunks; 3. Reduce the number of emitting signals. PR #16840.
This commit is contained in:
parent
ec1d2cba40
commit
be7cfb78de
25 changed files with 927 additions and 553 deletions
|
@ -138,8 +138,20 @@ AutoDownloader::AutoDownloader()
|
|||
m_processingTimer->setSingleShot(true);
|
||||
connect(m_processingTimer, &QTimer::timeout, this, &AutoDownloader::process);
|
||||
|
||||
if (isProcessingEnabled())
|
||||
startProcessing();
|
||||
const auto *btSession = BitTorrent::Session::instance();
|
||||
if (btSession->isRestored())
|
||||
{
|
||||
if (isProcessingEnabled())
|
||||
startProcessing();
|
||||
}
|
||||
else
|
||||
{
|
||||
connect(btSession, &BitTorrent::Session::restored, this, [this]()
|
||||
{
|
||||
if (isProcessingEnabled())
|
||||
startProcessing();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
AutoDownloader::~AutoDownloader()
|
||||
|
@ -506,7 +518,8 @@ void AutoDownloader::setProcessingEnabled(const bool enabled)
|
|||
m_storeProcessingEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
startProcessing();
|
||||
if (BitTorrent::Session::instance()->isRestored())
|
||||
startProcessing();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue