mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 16:31:29 +00:00
Rate limit saving to at most once a second
There are A LOT of unneeded saves ... This will prevent a lot of excessive database hits at least with very little room to exploit
This commit is contained in:
parent
acb5bb3e3e
commit
f26dce39c3
@ -155,7 +155,8 @@ Client::Client(EQStreamInterface* ieqs)
|
|||||||
m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number
|
m_Proximity(FLT_MAX, FLT_MAX, FLT_MAX), //arbitrary large number
|
||||||
m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f),
|
m_ZoneSummonLocation(-2.0f,-2.0f,-2.0f),
|
||||||
m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f),
|
m_AutoAttackPosition(0.0f, 0.0f, 0.0f, 0.0f),
|
||||||
m_AutoAttackTargetLocation(0.0f, 0.0f, 0.0f)
|
m_AutoAttackTargetLocation(0.0f, 0.0f, 0.0f),
|
||||||
|
m_lastsave(-1)
|
||||||
{
|
{
|
||||||
for(int cf=0; cf < _FilterCount; cf++)
|
for(int cf=0; cf < _FilterCount; cf++)
|
||||||
ClientFilters[cf] = FilterShow;
|
ClientFilters[cf] = FilterShow;
|
||||||
@ -569,6 +570,10 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
if(!ClientDataLoaded())
|
if(!ClientDataLoaded())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// saved less than 2 seconds ago, lets just skip for now
|
||||||
|
if ((time(nullptr) - m_lastsave) < 2)
|
||||||
|
return true;
|
||||||
|
|
||||||
/* Wrote current basics to PP for saves */
|
/* Wrote current basics to PP for saves */
|
||||||
m_pp.x = m_Position.x;
|
m_pp.x = m_Position.x;
|
||||||
m_pp.y = m_Position.y;
|
m_pp.y = m_Position.y;
|
||||||
@ -658,6 +663,7 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
|
|
||||||
database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp, &m_epp); /* Save Character Data */
|
database.SaveCharacterData(this->CharacterID(), this->AccountID(), &m_pp, &m_epp); /* Save Character Data */
|
||||||
|
|
||||||
|
m_lastsave = time(nullptr);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1458,6 +1458,9 @@ private:
|
|||||||
Timer helm_toggle_timer;
|
Timer helm_toggle_timer;
|
||||||
Timer light_update_timer;
|
Timer light_update_timer;
|
||||||
|
|
||||||
|
|
||||||
|
time_t m_lastsave;
|
||||||
|
|
||||||
glm::vec3 m_Proximity;
|
glm::vec3 m_Proximity;
|
||||||
|
|
||||||
void BulkSendInventoryItems();
|
void BulkSendInventoryItems();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user