mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-08-03 04:19:20 -04:00
go back to our original ...
This commit is contained in:
@@ -605,38 +605,52 @@ void Persister::saveCompleted(Snapshot *completedSnapshot)
|
||||
if (i!=m_savingSnapshots.end())
|
||||
{
|
||||
m_savingSnapshots.erase(i, m_savingSnapshots.end());
|
||||
}
|
||||
|
||||
if (m_savingSnapshots.empty()) {
|
||||
if (ConfigServerDatabase::getReportSaveTimes()) {
|
||||
|
||||
delete completedSnapshot;
|
||||
|
||||
if (m_savingSnapshots.empty() && ConfigServerDatabase::getReportSaveTimes())
|
||||
{
|
||||
int saveTime = Clock::timeMs() - m_saveStartTime;
|
||||
++m_saveCount;
|
||||
m_totalSaveTime += saveTime;
|
||||
if (saveTime > m_maxSaveTime)
|
||||
m_maxSaveTime = saveTime;
|
||||
|
||||
|
||||
DEBUG_REPORT_LOG(true,("Save completed in %i. (Average %i, max %i)\n", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
LOG("SaveTimes",("Save completed in %i. (Average %i, max %i)", saveTime, m_totalSaveTime/m_saveCount, m_maxSaveTime));
|
||||
|
||||
m_lastSaveTime = saveTime;
|
||||
}
|
||||
// message Central Server that the current save cycle is complete
|
||||
GenericValueTypeMessage<int> const saveCompleteMessage("DatabaseSaveComplete", ++m_saveCounter);
|
||||
DatabaseProcess::getInstance().sendToCentralServer(saveCompleteMessage, true);
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
}
|
||||
|
||||
// character snapshot deletions seem to work ok, but world and object snaps do not for deletion...wtf
|
||||
SnapshotListType::iterator j=std::remove(m_savingCharacterSnapshots.begin(),m_savingCharacterSnapshots.end(),completedSnapshot);
|
||||
if (j != m_savingCharacterSnapshots.end()) {
|
||||
m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end());
|
||||
}
|
||||
|
||||
if (completedSnapshot != nullptr) {
|
||||
if (m_savingSnapshots.empty())
|
||||
{
|
||||
// message Central Server that the current save cycle is complete
|
||||
GenericValueTypeMessage<int> const saveCompleteMessage("DatabaseSaveComplete", ++m_saveCounter);
|
||||
DatabaseProcess::getInstance().sendToCentralServer(saveCompleteMessage, true);
|
||||
LOG("Database",("Sending DatabaseSaveComplete network message to Central."));
|
||||
}
|
||||
|
||||
{
|
||||
// set the last save completion time (for the monitoring program)
|
||||
time_t theTime = time(0);
|
||||
m_lastSaveCompletionTime = ctime(&theTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SnapshotListType::iterator j=std::remove(m_savingCharacterSnapshots.begin(),m_savingCharacterSnapshots.end(),completedSnapshot);
|
||||
|
||||
DEBUG_FATAL(i==m_savingCharacterSnapshots.end(),("Programmer bug: SaveCompleted() called with a snapshot that wasn't in m_savingSnapshots or m_savingCharacterSnapshots."));
|
||||
|
||||
m_savingCharacterSnapshots.erase(j, m_savingCharacterSnapshots.end());
|
||||
|
||||
delete completedSnapshot;
|
||||
completedSnapshot = nullptr;
|
||||
|
||||
DEBUG_REPORT_LOG(ConfigServerDatabase::getReportSaveTimes(),("New character save completed\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void Persister::receiveMessage(const MessageDispatch::Emitter & source, const MessageDispatch::MessageBase & message)
|
||||
|
||||
Reference in New Issue
Block a user