try to fix freezing when updating feeds with new Qt
This commit is contained in:
parent
806cb57ccd
commit
1a0144a08f
@ -51,7 +51,7 @@ else
|
||||
USE_QT6="ON"
|
||||
|
||||
QTPATH="$(pwd)/Qt"
|
||||
QTVERSION="6.4.2"
|
||||
QTVERSION="6.4.3"
|
||||
QTBIN="$QTPATH/$QTVERSION/$QTOS/bin"
|
||||
|
||||
pip3 install aqtinstall
|
||||
|
@ -21,10 +21,10 @@ $ProgressPreference = 'SilentlyContinue'
|
||||
|
||||
# Get and prepare needed dependencies.
|
||||
if ($use_qt5 -eq "ON") {
|
||||
$qt_version = "5.15.2"
|
||||
$qt_version = "5.15.3"
|
||||
}
|
||||
else {
|
||||
$qt_version = "6.3.1"
|
||||
$qt_version = "6.4.3"
|
||||
}
|
||||
|
||||
$maria_version = "10.6.11"
|
||||
|
@ -157,7 +157,7 @@ void FeedDownloader::updateFeeds(const QList<Feed*>& feeds) {
|
||||
return updateThreadedFeed(fd);
|
||||
};
|
||||
|
||||
m_watcherLookup.setFuture(QtConcurrent::mapped(m_feeds, func));
|
||||
m_watcherLookup.setFuture(QtConcurrent::mapped(qApp->workHorsePool(), m_feeds, func));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,6 +172,8 @@ QString MessageObject::createLabelId(const QString& title, const QString& hex_co
|
||||
if (hex_color.isEmpty()) {
|
||||
// Generate color.
|
||||
}
|
||||
|
||||
// TODO: CONTINUE
|
||||
}
|
||||
|
||||
void MessageObject::addEnclosure(const QString& url, const QString& mime_type) const {
|
||||
|
@ -85,6 +85,7 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
|
||||
#endif
|
||||
|
||||
m_nodejs = new NodeJs(m_settings, this);
|
||||
m_workHorsePool = new QThreadPool(this);
|
||||
m_webFactory = new WebFactory(this);
|
||||
m_system = new SystemFactory(this);
|
||||
m_skins = new SkinFactory(this);
|
||||
@ -215,7 +216,7 @@ Application::Application(const QString& id, int& argc, char** argv, const QStrin
|
||||
|
||||
QTimer::singleShot(1000, system(), &SystemFactory::checkForUpdatesOnStartup);
|
||||
|
||||
setupGlobalThreadPool();
|
||||
setupWorkHorsePool();
|
||||
|
||||
qDebugNN << LOGSEC_CORE << "OpenSSL version:" << QUOTE_W_SPACE_DOT(QSslSocket::sslLibraryVersionString());
|
||||
qDebugNN << LOGSEC_CORE << "OpenSSL supported:" << QUOTE_W_SPACE_DOT(QSslSocket::supportsSsl());
|
||||
@ -392,6 +393,10 @@ void Application::displayLogMessageInDialog(const QString& message) {
|
||||
}
|
||||
}
|
||||
|
||||
QThreadPool* Application::workHorsePool() const {
|
||||
return m_workHorsePool;
|
||||
}
|
||||
|
||||
int Application::customAdblockPort() const {
|
||||
return m_customAdblockPort;
|
||||
}
|
||||
@ -948,20 +953,20 @@ void Application::setupCustomDataFolder(const QString& data_folder) {
|
||||
m_customDataFolder = data_folder;
|
||||
}
|
||||
|
||||
void Application::setupGlobalThreadPool() {
|
||||
void Application::setupWorkHorsePool() {
|
||||
auto ideal_th_count = QThread::idealThreadCount();
|
||||
int custom_threads = m_cmdParser.value(QSL(CLI_THREADS)).toInt();
|
||||
|
||||
if (custom_threads > 0) {
|
||||
QThreadPool::globalInstance()->setMaxThreadCount((std::min)(MAX_THREADPOOL_THREADS, custom_threads));
|
||||
m_workHorsePool->setMaxThreadCount((std::min)(MAX_THREADPOOL_THREADS, custom_threads));
|
||||
}
|
||||
else if (ideal_th_count > 1) {
|
||||
QThreadPool::globalInstance()->setMaxThreadCount((std::min)(MAX_THREADPOOL_THREADS, 2 * ideal_th_count));
|
||||
m_workHorsePool->setMaxThreadCount((std::min)(MAX_THREADPOOL_THREADS, 2 * ideal_th_count));
|
||||
}
|
||||
|
||||
// NOTE: Do not expire threads so that their IDs are not reused.
|
||||
// This fixes cross-thread QSqlDatabase access.
|
||||
QThreadPool::globalInstance()->setExpiryTimeout(-1);
|
||||
m_workHorsePool->setExpiryTimeout(-1);
|
||||
}
|
||||
|
||||
void Application::onAdBlockFailure() {
|
||||
|
@ -181,6 +181,8 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||
|
||||
int customAdblockPort() const;
|
||||
|
||||
QThreadPool* workHorsePool() const;
|
||||
|
||||
public slots:
|
||||
// Restarts the application.
|
||||
void restart();
|
||||
@ -223,7 +225,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||
#endif
|
||||
|
||||
void setupCustomDataFolder(const QString& data_folder);
|
||||
void setupGlobalThreadPool();
|
||||
void setupWorkHorsePool();
|
||||
void determineFirstRuns();
|
||||
void eliminateFirstRuns();
|
||||
void displayLogMessageInDialog(const QString& message);
|
||||
@ -263,6 +265,7 @@ class RSSGUARD_DLLSPEC Application : public SingleApplication {
|
||||
DownloadManager* m_downloadManager;
|
||||
NotificationFactory* m_notifications;
|
||||
NodeJs* m_nodejs;
|
||||
QThreadPool* m_workHorsePool;
|
||||
bool m_shouldRestart;
|
||||
bool m_firstRunEver;
|
||||
bool m_firstRunCurrentVersion;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlError>
|
||||
#include <QStack>
|
||||
#include <QtConcurrent/QtConcurrentMap>
|
||||
#include <QtConcurrentMap>
|
||||
|
||||
FeedsImportExportModel::FeedsImportExportModel(QObject* parent)
|
||||
: AccountCheckSortedModel(parent), m_mode(Mode::Import), m_newRoot(nullptr) {
|
||||
@ -380,7 +380,7 @@ void FeedsImportExportModel::importAsOPML20(const QByteArray& data,
|
||||
return produceFeed(lookup);
|
||||
};
|
||||
|
||||
QFuture<bool> fut = QtConcurrent::mapped(m_lookup, func);
|
||||
QFuture<bool> fut = QtConcurrent::mapped(qApp->workHorsePool(), m_lookup, func);
|
||||
|
||||
m_watcherLookup.setFuture(fut);
|
||||
|
||||
@ -445,7 +445,7 @@ void FeedsImportExportModel::importAsTxtURLPerLine(const QByteArray& data,
|
||||
return produceFeed(lookup);
|
||||
};
|
||||
|
||||
QFuture<bool> fut = QtConcurrent::mapped(m_lookup, func);
|
||||
QFuture<bool> fut = QtConcurrent::mapped(qApp->workHorsePool(), m_lookup, func);
|
||||
|
||||
m_watcherLookup.setFuture(fut);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user