]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
disable our code for network timeout
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 25 Sep 2024 09:41:16 +0000 (11:41 +0200)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 26 Sep 2024 14:11:37 +0000 (16:11 +0200)
seems we have an issue with Windows and QTimer instances used to detect
network timeout

workaround, find cause of https://github.com/nextcloud/desktop/issues/7184

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/abstractnetworkjob.cpp
src/libsync/abstractnetworkjob.h
test/testchunkingng.cpp
test/testremotediscovery.cpp

index 5e9df7067e4b57ec435796f353eeccda8c0f6924..f08b135823f79f884249b456649c289931629a0b 100644 (file)
@@ -46,6 +46,7 @@ Q_LOGGING_CATEGORY(lcNetworkJob, "nextcloud.sync.networkjob", QtInfoMsg)
 
 // If not set, it is overwritten by the Application constructor with the value from the config
 int AbstractNetworkJob::httpTimeout = qEnvironmentVariableIntValue("OWNCLOUD_TIMEOUT");
+bool AbstractNetworkJob::enableTimeout = false;
 
 AbstractNetworkJob::AbstractNetworkJob(const AccountPtr &account, const QString &path, QObject *parent)
     : QObject(parent)
@@ -57,7 +58,6 @@ AbstractNetworkJob::AbstractNetworkJob(const AccountPtr &account, const QString
     ASSERT(account != parent);
 
     _timer.setSingleShot(true);
-    _timer.setTimerType(Qt::VeryCoarseTimer);
     _timer.setInterval((httpTimeout ? httpTimeout : 300) * 1000); // default to 5 minutes.
     connect(&_timer, &QTimer::timeout, this, &AbstractNetworkJob::slotTimeout);
 
@@ -367,6 +367,11 @@ void AbstractNetworkJob::start()
 
 void AbstractNetworkJob::slotTimeout()
 {
+    // TODO: workaround, find cause of https://github.com/nextcloud/desktop/issues/7184
+    if (!AbstractNetworkJob::enableTimeout) {
+        return;
+    }
+
     _timedout = true;
     qCWarning(lcNetworkJob) << "Network job timeout" << (reply() ? reply()->request().url() : path());
     onTimedOut();
index 814f0e8460523a2b657c433094977a2f34d20a65..aefcfb630e142e9b947415d4403211e99423d990 100644 (file)
@@ -45,6 +45,8 @@ public:
     explicit AbstractNetworkJob(const AccountPtr &account, const QString &path, QObject *parent = nullptr);
     ~AbstractNetworkJob() override;
 
+    static bool enableTimeout;
+
     virtual void start();
 
     [[nodiscard]] AccountPtr account() const { return _account; }
index 8c643511ecd90a145b96bd64ff0027ffb7a4f733..8ec79d34ad593e28c4f3b912288f81cd4d567f55 100644 (file)
@@ -60,6 +60,8 @@ class TestChunkingNG : public QObject
 private slots:
     void initTestCase()
     {
+        AbstractNetworkJob::enableTimeout = true;
+
         OCC::Logger::instance()->setLogFlush(true);
         OCC::Logger::instance()->setLogDebug(true);
 
index cd5bec23145e004884af89d943906569c8fcfa08..a688b8d92cf76e3971c9d7831c7a3fa0ed0d7424 100644 (file)
@@ -50,6 +50,8 @@ class TestRemoteDiscovery : public QObject
 private slots:
     void initTestCase()
     {
+        AbstractNetworkJob::enableTimeout = true;
+
         OCC::Logger::instance()->setLogFlush(true);
         OCC::Logger::instance()->setLogDebug(true);