Merge pull request #16119 from howard-stearns/do-not-unzip-or-parse-entities-backup-on-message-thread

do not unzip or parse entities-backup on message thread
This commit is contained in:
Howard Stearns 2019-08-29 15:20:19 -07:00 committed by GitHub
commit 0b83438ee8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1746,8 +1746,8 @@ void DomainServer::nodePingMonitor() {
}
void DomainServer::processOctreeDataPersistMessage(QSharedPointer<ReceivedMessage> message) {
qDebug() << "Received octree data persist message";
auto data = message->readAll();
qDebug() << "Received octree data persist message" << (data.size() / 1000) << "kbytes.";
auto filePath = getEntitiesFilePath();
QDir dir(getEntitiesDirPath());
@ -1759,12 +1759,16 @@ void DomainServer::processOctreeDataPersistMessage(QSharedPointer<ReceivedMessag
QFile f(filePath);
if (f.open(QIODevice::WriteOnly)) {
f.write(data);
#ifdef EXPENSIVE_NETWORK_DIAGNOSTICS
// These diagnostics take take more than 200ms (depending on content size),
// causing Socket::readPendingDatagrams to overrun its timebox.
OctreeUtils::RawEntityData entityData;
if (entityData.readOctreeDataInfoFromData(data)) {
qCDebug(domain_server) << "Wrote new entities file" << entityData.id << entityData.dataVersion;
} else {
qCDebug(domain_server) << "Failed to read new octree data info";
}
#endif
} else {
qCDebug(domain_server) << "Failed to write new entities file:" << filePath;
}