Add cancellation of well path collection loading.

This commit is contained in:
Kristian Bendiksen
2024-08-14 16:54:41 +02:00
parent 8d92908253
commit bf2a852b4d
12 changed files with 143 additions and 19 deletions

View File

@@ -762,6 +762,9 @@ void RiaOsduConnector::requestParquetData( const QString& url, const QString& da
RiaLogging::info( "Requesting download of parquet from: " + url );
auto reply = makeDownloadRequest( url, dataPartitionId, token, RiaCloudDefines::contentTypeParquet() );
m_repliesMutex.lock();
m_replies[id] = reply;
m_repliesMutex.unlock();
connect( reply,
&QNetworkReply::finished,
@@ -792,3 +795,19 @@ void RiaOsduConnector::parquetDownloadComplete( const QByteArray& contents, cons
m_parquetData[id] = contents;
m_parquetErrors[id] = errorMessage;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaOsduConnector::cancelRequestForId( const QString& id )
{
QMutexLocker lock( &m_repliesMutex );
auto it = m_replies.find( id );
if ( it != m_replies.end() )
{
if ( !it->second.isNull() )
{
it->second->abort();
}
}
}

View File

@@ -113,6 +113,8 @@ public:
QString wellIdForWellboreId( const QString& wellboreId ) const;
void cancelRequestForId( const QString& id );
void clearCachedData();
QString dataPartition() const;
@@ -173,6 +175,7 @@ private:
const QString m_dataPartitionId;
mutable QMutex m_mutex;
mutable QMutex m_repliesMutex;
std::vector<OsduField> m_fields;
std::vector<OsduWell> m_wells;
std::map<QString, std::vector<OsduWellbore>> m_wellbores;
@@ -180,4 +183,5 @@ private:
std::map<QString, std::vector<OsduWellLog>> m_wellLogs;
std::map<QString, QByteArray> m_parquetData;
std::map<QString, QString> m_parquetErrors;
std::map<QString, QPointer<QNetworkReply>> m_replies;
};