mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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
This commit is contained in:
parent
0717719073
commit
c1d7dbfc38
5 changed files with 15 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue