mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Store reachability of FileProviderExt by respective account
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
4ecaed47df
commit
c48ecf8d60
@ -54,7 +54,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QHash<QString, void*> _clientCommServices;
|
||||
QDateTime _lastUnreachableTime;
|
||||
QHash<QString, QDateTime> _unreachableAccountExtensions;
|
||||
};
|
||||
|
||||
} // namespace OCC::Mac
|
||||
|
||||
@ -146,7 +146,8 @@ void FileProviderXPC::createDebugArchiveForExtension(const QString &extensionAcc
|
||||
|
||||
bool FileProviderXPC::fileProviderExtReachable(const QString &extensionAccountId)
|
||||
{
|
||||
if (_lastUnreachableTime.isValid() && _lastUnreachableTime.secsTo(QDateTime::currentDateTime()) < ::reachableRetryTimeout) {
|
||||
const auto lastUnreachableTime = _unreachableAccountExtensions.value(extensionAccountId);
|
||||
if (lastUnreachableTime.isValid() && lastUnreachableTime.secsTo(QDateTime::currentDateTime()) < ::reachableRetryTimeout) {
|
||||
qCInfo(lcFileProviderXPC) << "File provider extension was unreachable less than a minute ago. "
|
||||
<< "Not checking again";
|
||||
return false;
|
||||
@ -165,9 +166,11 @@ bool FileProviderXPC::fileProviderExtReachable(const QString &extensionAccountId
|
||||
}];
|
||||
dispatch_semaphore_wait(semaphore, dispatch_time(DISPATCH_TIME_NOW, semaphoreWaitDelta));
|
||||
|
||||
if (!response) {
|
||||
if (response) {
|
||||
_unreachableAccountExtensions.remove(extensionAccountId);
|
||||
} else {
|
||||
qCWarning(lcFileProviderXPC) << "Could not reach file provider extension.";
|
||||
_lastUnreachableTime = QDateTime::currentDateTime();
|
||||
_unreachableAccountExtensions.insert(extensionAccountId, QDateTime::currentDateTime());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user