From c1d7dbfc38e8f48b42d957afad2696a8e56b740b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Fri, 4 Jan 2019 10:20:04 +0100 Subject: Fix various player save issues (performance penalty on sql backends + bugs) * PostgreSQL & SQLite3 doesn't setModified(false) on RemotePlayer, then player is saved on each server save call. This results in heavy useless writes. * PostgreSQL & SQLite3 ack engine meta write whereas db commit hasn't been performed. If commit failed write has failed. We mustn't notify engine write is done. * serializing player meta must not setModified(false) because it didn't ensure write has been done * add RemotePlayer::on_successfull_save callback to do the flag update on a successful save --- src/remoteplayer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/remoteplayer.cpp') diff --git a/src/remoteplayer.cpp b/src/remoteplayer.cpp index d54caf924..18749d5ff 100644 --- a/src/remoteplayer.cpp +++ b/src/remoteplayer.cpp @@ -79,8 +79,6 @@ void RemotePlayer::serializeExtraAttributes(std::string &output) } output = fastWriteJson(json_root); - - m_sao->getMeta().setModified(false); } @@ -225,3 +223,10 @@ const RemotePlayerChatResult RemotePlayer::canSendChatMessage() m_chat_message_allowance -= 1.0f; return RPLAYER_CHATRESULT_OK; } + +void RemotePlayer::on_successful_save() +{ + setModified(false); + if (m_sao) + m_sao->getMeta().setModified(false); +} -- cgit v1.2.3