Skip to content

Commit ce44a84

Browse files
committed
Merge branch 'work/improveEfficiency' of github.com:owncloud/client into work/improveEfficiency
2 parents 7ebda15 + cecdfb6 commit ce44a84

27 files changed

+92
-69
lines changed

src/gui/scheduling/etagwatcher.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ void ETagWatcher::startOC10EtagJob(Folder *f)
105105
connect(requestEtagJob, &RequestEtagJob::finishedSignal, this, [requestEtagJob, f, this] {
106106
if (requestEtagJob->httpStatusCode() == 207) {
107107
if (OC_ENSURE_NOT(requestEtagJob->etag().isEmpty())) {
108-
f->accountState()->tagLastSuccessfullETagRequest(requestEtagJob->responseQTimeStamp());
108+
auto lastResponse = requestEtagJob->responseQTimeStamp();
109+
if (!lastResponse.isValid()) {
110+
// If the responose had no valid "Date" header, use "now", as the job just finished.
111+
lastResponse = QDateTime::currentDateTimeUtc();
112+
}
113+
f->accountState()->tagLastSuccessfullETagRequest(lastResponse);
109114
updateEtag(f, requestEtagJob->etag());
110115
} else {
111116
qCWarning(lcEtagWatcher) << "Invalid empty etag received for" << f->displayName() << f->path() << requestEtagJob;

src/libsync/abstractnetworkjob.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ void AbstractNetworkJob::slotFinished()
238238

239239
QByteArray AbstractNetworkJob::responseTimestamp() const
240240
{
241-
OC_ASSERT(!_responseTimestamp.isEmpty() || _aborted || (reply() && reply()->error() == QNetworkReply::RemoteHostClosedError));
242241
return _responseTimestamp;
243242
}
244243

src/libsync/abstractnetworkjob.h

+11
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,18 @@ class OWNCLOUDSYNC_EXPORT AbstractNetworkJob : public QObject
7474
void setForceIgnoreCredentialFailure(bool ignore);
7575
bool ignoreCredentialFailure() const;
7676

77+
/**
78+
* @brief Returns the timestamp from the reply
79+
*
80+
* @return Empty if the job was aborted, or an error occurred and no response was received.
81+
* Otherwise the timestamp from the reply header. Note that the timestamp might be
82+
* absent if the reply didn't contain one.
83+
*/
7784
QByteArray responseTimestamp() const;
85+
/**
86+
* See responseTimestamp(), now converted to a QDateTime. If there was no response timestamp,
87+
* return an invalid `QDateTime`.
88+
*/
7889
QDateTime responseQTimeStamp() const;
7990

8091
int httpStatusCode() const;

src/libsync/discoveryphase.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,14 @@ void DiscoverySingleDirectoryJob::lsJobFinishedWithoutErrorSlot()
422422
deleteLater();
423423
return;
424424
}
425-
Q_EMIT etag(_firstEtag, _proFindJob->responseQTimeStamp());
425+
426+
auto lastResponse = _proFindJob->responseQTimeStamp();
427+
if (!lastResponse.isValid()) {
428+
// If the responose had no valid "Date" header, use "now", as the job just finished.
429+
lastResponse = QDateTime::currentDateTimeUtc();
430+
}
431+
432+
Q_EMIT etag(_firstEtag, lastResponse);
426433
Q_EMIT finished(_results);
427434
deleteLater();
428435
}

test/testutils/syncenginetestutils.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,7 @@ void FakeGetReply::respond()
661661
// It can happen that this job is cancelled before the full data is read, and the job is aborted. This being the test framework, processing happens
662662
// synchronously, so between the signals above and here, the job can get aborted, which emits the finished signal. So do NOT emit it again if
663663
// this is the case.
664+
setFinished(true);
664665
Q_EMIT finished();
665666
}
666667
}

translations/client_ar.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,17 @@ File synchronization desktop utility.</translation>
575575
<context>
576576
<name>OCC::AbstractNetworkJob</name>
577577
<message>
578-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
578+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
579579
<source>Connection timed out</source>
580580
<translation>انتهت مهلة الاتصال</translation>
581581
</message>
582582
<message>
583-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
583+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
584584
<source>Unknown error: network reply was deleted</source>
585585
<translation>خطأ غير معروف: تم حذف رد الشبكة</translation>
586586
</message>
587587
<message>
588-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
588+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
589589
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
590590
<translation>رد الخادم &quot;%1 %2&quot; على &quot;%3 %4&quot;</translation>
591591
</message>

translations/client_bg_BG.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,17 @@ File synchronization desktop utility.</source>
575575
<context>
576576
<name>OCC::AbstractNetworkJob</name>
577577
<message>
578-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
578+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
579579
<source>Connection timed out</source>
580580
<translation>Времето за изчакване на връзката изтече</translation>
581581
</message>
582582
<message>
583-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
583+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
584584
<source>Unknown error: network reply was deleted</source>
585585
<translation>Неизвестна грешка: мрежовият отговор беше изтрит</translation>
586586
</message>
587587
<message>
588-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
588+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
589589
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
590590
<translation>Сървърът отговори &quot;%1%2&quot; в &quot;%3%4&quot;</translation>
591591
</message>

translations/client_cs.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -574,17 +574,17 @@ File synchronization desktop utility.</source>
574574
<context>
575575
<name>OCC::AbstractNetworkJob</name>
576576
<message>
577-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
577+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
578578
<source>Connection timed out</source>
579579
<translation>Připojení vypršelo</translation>
580580
</message>
581581
<message>
582-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
582+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
583583
<source>Unknown error: network reply was deleted</source>
584584
<translation>Neznámá chyba: odpověď sítě byla smazána</translation>
585585
</message>
586586
<message>
587-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
587+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
588588
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
589589
<translation>Odpověď serveru &quot;%1 %2&quot; do &quot;%3 %4&quot;</translation>
590590
</message>

translations/client_de-informal.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,17 @@ Datei Synchronisations-Applikation.</translation>
577577
<context>
578578
<name>OCC::AbstractNetworkJob</name>
579579
<message>
580-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
580+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
581581
<source>Connection timed out</source>
582582
<translation>Zeitüberschreitung beim Verbindungsaufbau</translation>
583583
</message>
584584
<message>
585-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
585+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
586586
<source>Unknown error: network reply was deleted</source>
587587
<translation>Unbekannter Fehler: Die Netzwerk-Antwort wurde gelöscht</translation>
588588
</message>
589589
<message>
590-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
590+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
591591
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
592592
<translation>Der Server hat &quot;%1 %2&quot; auf &quot;%3 %4&quot; geantwortet</translation>
593593
</message>

translations/client_de.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,17 @@ Anwendung zur Datei-Synchronisation.</translation>
577577
<context>
578578
<name>OCC::AbstractNetworkJob</name>
579579
<message>
580-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
580+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
581581
<source>Connection timed out</source>
582582
<translation>Zeitüberschreitung bei der Verbindung</translation>
583583
</message>
584584
<message>
585-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
585+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
586586
<source>Unknown error: network reply was deleted</source>
587587
<translation>Unbekannter Fehler: Die Netzwerk-Antwort wurde gelöscht</translation>
588588
</message>
589589
<message>
590-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
590+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
591591
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
592592
<translation>Der Server hat &quot;%1 %2&quot; auf &quot;%3 %4&quot; geantwortet</translation>
593593
</message>

translations/client_de_AT.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,17 @@ Datei Synchronisations-Applikation.</translation>
575575
<context>
576576
<name>OCC::AbstractNetworkJob</name>
577577
<message>
578-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
578+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
579579
<source>Connection timed out</source>
580580
<translation>Zeitüberschreitung beim Verbindungsaufbau</translation>
581581
</message>
582582
<message>
583-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
583+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
584584
<source>Unknown error: network reply was deleted</source>
585585
<translation>Unbekannter Fehler: Die Netzwerk-Antwort wurde gelöscht</translation>
586586
</message>
587587
<message>
588-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
588+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
589589
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
590590
<translation>Der Server hat &quot;%1 %2&quot; auf &quot;%3 %4&quot; geantwortet</translation>
591591
</message>

translations/client_de_CH.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,17 @@ Datei Synchronisations-Applikation.</translation>
575575
<context>
576576
<name>OCC::AbstractNetworkJob</name>
577577
<message>
578-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
578+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
579579
<source>Connection timed out</source>
580580
<translation>Zeitüberschreitung beim Verbindungsaufbau</translation>
581581
</message>
582582
<message>
583-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
583+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
584584
<source>Unknown error: network reply was deleted</source>
585585
<translation>Unbekannter Fehler: Die Netzwerk-Antwort wurde gelöscht</translation>
586586
</message>
587587
<message>
588-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
588+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
589589
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
590590
<translation>Der Server hat &quot;%1 %2&quot; auf &quot;%3 %4&quot; geantwortet</translation>
591591
</message>

translations/client_en.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -579,17 +579,17 @@ File synchronization desktop utility.</source>
579579
<context>
580580
<name>OCC::AbstractNetworkJob</name>
581581
<message>
582-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
582+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
583583
<source>Connection timed out</source>
584584
<translation type="unfinished"></translation>
585585
</message>
586586
<message>
587-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
587+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
588588
<source>Unknown error: network reply was deleted</source>
589589
<translation type="unfinished"></translation>
590590
</message>
591591
<message>
592-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
592+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
593593
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
594594
<translation type="unfinished"></translation>
595595
</message>

translations/client_en_GB.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,17 @@ File synchronisation desktop utility.</translation>
577577
<context>
578578
<name>OCC::AbstractNetworkJob</name>
579579
<message>
580-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
580+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
581581
<source>Connection timed out</source>
582582
<translation>Connection timed out</translation>
583583
</message>
584584
<message>
585-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
585+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
586586
<source>Unknown error: network reply was deleted</source>
587587
<translation>Unknown error: network reply was deleted</translation>
588588
</message>
589589
<message>
590-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
590+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
591591
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
592592
<translation>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</translation>
593593
</message>

translations/client_es.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,17 @@ Cliente de escritorio para la sincronización de archivos.</translation>
575575
<context>
576576
<name>OCC::AbstractNetworkJob</name>
577577
<message>
578-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
578+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
579579
<source>Connection timed out</source>
580580
<translation>Tiempo de conexión agotado</translation>
581581
</message>
582582
<message>
583-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
583+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
584584
<source>Unknown error: network reply was deleted</source>
585585
<translation>Error desconocido: la respuesta de red fue eliminada</translation>
586586
</message>
587587
<message>
588-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
588+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
589589
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
590590
<translation>El servidor respondió &quot;%1 %2&quot; a &quot;%3 %4&quot;</translation>
591591
</message>

translations/client_et.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,17 @@ Failide sünkroniseerimise töölaua rakendus.</translation>
577577
<context>
578578
<name>OCC::AbstractNetworkJob</name>
579579
<message>
580-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
580+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
581581
<source>Connection timed out</source>
582582
<translation>Ühendus aegus</translation>
583583
</message>
584584
<message>
585-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
585+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
586586
<source>Unknown error: network reply was deleted</source>
587587
<translation>Tundmatu viga: võrguvastus kustutati</translation>
588588
</message>
589589
<message>
590-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
590+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
591591
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
592592
<translation>Server vastas &quot;%3 %4&quot; päringule &quot;%1 %2&quot;</translation>
593593
</message>

translations/client_it.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,17 @@ Utilità desktop per la sincronizzazione dei file.</translation>
577577
<context>
578578
<name>OCC::AbstractNetworkJob</name>
579579
<message>
580-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
580+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
581581
<source>Connection timed out</source>
582582
<translation>Connessione scaduta</translation>
583583
</message>
584584
<message>
585-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
585+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
586586
<source>Unknown error: network reply was deleted</source>
587587
<translation>Errore sconosciuto: la risposta di rete è stata eliminata</translation>
588588
</message>
589589
<message>
590-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
590+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
591591
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
592592
<translation>Il server ha risposto &quot;%1 %2&quot; a &quot;%3 %4&quot;</translation>
593593
</message>

translations/client_ja.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,17 @@ File synchronization desktop utility.</source>
577577
<context>
578578
<name>OCC::AbstractNetworkJob</name>
579579
<message>
580-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
580+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
581581
<source>Connection timed out</source>
582582
<translation>接続タイムアウト</translation>
583583
</message>
584584
<message>
585-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
585+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
586586
<source>Unknown error: network reply was deleted</source>
587587
<translation>未知のエラーです:ネットワーク応答が削除されました</translation>
588588
</message>
589589
<message>
590-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
590+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
591591
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
592592
<translation>サーバの返答は &quot;%1 %2&quot; から &quot;%3 %4&quot;です</translation>
593593
</message>

translations/client_ko.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -575,17 +575,17 @@ File synchronization desktop utility.</source>
575575
<context>
576576
<name>OCC::AbstractNetworkJob</name>
577577
<message>
578-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="258"/>
578+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="257"/>
579579
<source>Connection timed out</source>
580580
<translation>연결 시간 초과됨</translation>
581581
</message>
582582
<message>
583-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="260"/>
583+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="259"/>
584584
<source>Unknown error: network reply was deleted</source>
585585
<translation>알 수 없는 오류: 네트워크 응답이 삭제됨</translation>
586586
</message>
587587
<message>
588-
<location filename="../src/libsync/abstractnetworkjob.cpp" line="361"/>
588+
<location filename="../src/libsync/abstractnetworkjob.cpp" line="360"/>
589589
<source>Server replied &quot;%1 %2&quot; to &quot;%3 %4&quot;</source>
590590
<translation>서버 응답: &quot;%1 %2&quot; - &quot;%3 %4&quot;</translation>
591591
</message>

0 commit comments

Comments
 (0)