Write out objects sooner so we're more likely to have them after a crash.

This commit is contained in:
JoelKatz
2012-10-15 00:46:08 -07:00
parent 3872cbbca0
commit db0d9447cd

View File

@@ -35,15 +35,18 @@ bool HashedObjectStore::store(HashedObjectType type, uint32 index,
HashedObject::pointer object = boost::make_shared<HashedObject>(type, index, data, hash);
if (!mCache.canonicalize(hash, object))
{
// cLog(lsTRACE) << "Queuing write for " << hash;
boost::recursive_mutex::scoped_lock sl(mWriteMutex);
mWriteSet.push_back(object);
if (!mWritePending && (mWriteSet.size() >= 64))
if (!mWritePending)
{
mWritePending = true;
boost::thread t(boost::bind(&HashedObjectStore::bulkWrite, this));
t.detach();
}
}
// else
// cLog(lsTRACE) << "HOS: already had " << hash;
return true;
}