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

[stable-3.14] disable our code for network timeout #7218

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/libsync/abstractnetworkjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* for more details.
*/

#include <QLoggingCategory>

Check failure on line 16 in src/libsync/abstractnetworkjob.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/abstractnetworkjob.cpp:16:10 [clang-diagnostic-error]

'QLoggingCategory' file not found
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QNetworkReply>
Expand Down Expand Up @@ -46,6 +46,7 @@

// 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)
Expand All @@ -57,7 +58,6 @@
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);

Expand Down Expand Up @@ -367,6 +367,11 @@

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();
Expand Down
2 changes: 2 additions & 0 deletions src/libsync/abstractnetworkjob.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#pragma once

#include "owncloudlib.h"

Check failure on line 18 in src/libsync/abstractnetworkjob.h

View workflow job for this annotation

GitHub Actions / build

src/libsync/abstractnetworkjob.h:18:10 [clang-diagnostic-error]

'owncloudlib.h' file not found

#include "accountfwd.h"
#include "common/asserts.h"
Expand Down Expand Up @@ -45,6 +45,8 @@
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; }
Expand Down
2 changes: 2 additions & 0 deletions test/testchunkingng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions test/testremotediscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

#include <QtTest>

Check failure on line 8 in test/testremotediscovery.cpp

View workflow job for this annotation

GitHub Actions / build

test/testremotediscovery.cpp:8:10 [clang-diagnostic-error]

'QtTest' file not found
#include "syncenginetestutils.h"
#include <syncengine.h>
#include <localdiscoverytracker.h>
Expand Down Expand Up @@ -50,6 +50,8 @@
private slots:
void initTestCase()
{
AbstractNetworkJob::enableTimeout = true;

OCC::Logger::instance()->setLogFlush(true);
OCC::Logger::instance()->setLogDebug(true);

Expand Down
Loading