disable our code for network timeout

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>
This commit is contained in:
Matthieu Gallien 2024-09-25 11:41:16 +02:00 committed by backportbot[bot]
parent abbbc29e5f
commit 14aef728b4
4 changed files with 12 additions and 1 deletions

View 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();

View 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; }

View 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);

View 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);