1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 22:46:38 +02:00

Fixed some 100% cpu bugs with the new SQL stuff, and fixed sqlite+db_sql_live

This commit is contained in:
Adam
2012-05-08 18:04:49 -04:00
parent 25586f3246
commit 820e4edc2b
7 changed files with 41 additions and 14 deletions
+12 -2
View File
@@ -70,7 +70,7 @@ unsigned stringstream::getMax() const
return this->_max;
}
Serializable::Serializable() : id(0)
Serializable::Serializable() : last_commit_time(0), id(0)
{
if (serializable_items == NULL)
serializable_items = new std::list<Serializable *>();
@@ -82,7 +82,7 @@ Serializable::Serializable() : id(0)
FOREACH_MOD(I_OnSerializableConstruct, OnSerializableConstruct(this));
}
Serializable::Serializable(const Serializable &) : id(0)
Serializable::Serializable(const Serializable &) : last_commit_time(0), id(0)
{
serializable_items->push_back(this);
this->s_iter = serializable_items->end();
@@ -126,6 +126,16 @@ void Serializable::UpdateCache()
this->last_commit = this->serialize();
}
bool Serializable::IsTSCached()
{
return this->last_commit_time == Anope::CurTime;
}
void Serializable::UpdateTS()
{
this->last_commit_time = Anope::CurTime;
}
const std::list<Serializable *> &Serializable::GetItems()
{
return *serializable_items;