mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 01:05:34 +08:00
refs #930, support compression for uploads in DB writer
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f2602a8915
commit
4bb29de652
@@ -10,6 +10,7 @@
|
|||||||
#include "blackcore/application.h"
|
#include "blackcore/application.h"
|
||||||
#include "blackcore/data/globalsetup.h"
|
#include "blackcore/data/globalsetup.h"
|
||||||
#include "blackcore/db/databasewriter.h"
|
#include "blackcore/db/databasewriter.h"
|
||||||
|
#include "blackcore/db/databaseutils.h"
|
||||||
#include "blackmisc/db/datastoreutility.h"
|
#include "blackmisc/db/datastoreutility.h"
|
||||||
#include "blackmisc/logcategory.h"
|
#include "blackmisc/logcategory.h"
|
||||||
#include "blackmisc/logcategorylist.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
@@ -29,6 +30,7 @@ using namespace BlackMisc;
|
|||||||
using namespace BlackMisc::Db;
|
using namespace BlackMisc::Db;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
using namespace BlackMisc::Simulation;
|
using namespace BlackMisc::Simulation;
|
||||||
|
using namespace BlackCore::Db;
|
||||||
|
|
||||||
namespace BlackCore
|
namespace BlackCore
|
||||||
{
|
{
|
||||||
@@ -73,16 +75,18 @@ namespace BlackCore
|
|||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl url(m_modelPublishUrl.toQUrl());
|
const bool compress = models.size() > 3;
|
||||||
QNetworkRequest request(url);
|
|
||||||
CNetworkUtils::ignoreSslVerification(request);
|
|
||||||
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this);
|
QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType, this);
|
||||||
multiPart->append(CNetworkUtils::getJsonTextMultipart(models.toDatabaseJson()));
|
multiPart->append(CDatabaseUtils::getJsonTextMultipart(models.toDatabaseJson(), compress));
|
||||||
if (sApp->getGlobalSetup().dbDebugFlag())
|
if (sApp->getGlobalSetup().dbDebugFlag())
|
||||||
{
|
{
|
||||||
multiPart->append(CNetworkUtils::getMultipartWithDebugFlag());
|
multiPart->append(CDatabaseUtils::getMultipartWithDebugFlag());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUrl url(m_modelPublishUrl.toQUrl());
|
||||||
|
if (compress) { url.setQuery(CDatabaseUtils::getCompressedQuery()); }
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
CNetworkUtils::ignoreSslVerification(request);
|
||||||
m_pendingReply = sApp->postToNetwork(request, multiPart, { this, &CDatabaseWriter::ps_postModelsResponse});
|
m_pendingReply = sApp->postToNetwork(request, multiPart, { this, &CDatabaseWriter::ps_postModelsResponse});
|
||||||
m_replyPendingSince = QDateTime::currentMSecsSinceEpoch();
|
m_replyPendingSince = QDateTime::currentMSecsSinceEpoch();
|
||||||
return msgs;
|
return msgs;
|
||||||
|
|||||||
Reference in New Issue
Block a user