mirror of
https://github.com/Zygo/bees.git
synced 2025-06-17 01:56:16 +02:00
roots: correctly track crawl dirty state
If there's an error while writing the crawl state, the state should remain dirty. If the crawl state is successfully written, the state is only clean if there were no changes to crawl state since the write was committed. We need to release the lock while writing the state but correctly set the dirty flag when the state is written successfully. Replace the bool with a version number counter. Track the last version successfully saved and the current version of the crawl state. The state is dirty if these counters disagree and clean if they agree. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -544,7 +544,8 @@ class BeesRoots : public enable_shared_from_this<BeesRoots> {
|
||||
BeesStringFile m_crawl_state_file;
|
||||
map<uint64_t, shared_ptr<BeesCrawl>> m_root_crawl_map;
|
||||
mutex m_mutex;
|
||||
bool m_crawl_dirty = false;
|
||||
uint64_t m_crawl_dirty = 0;
|
||||
uint64_t m_crawl_clean = 0;
|
||||
Timer m_crawl_timer;
|
||||
BeesThread m_crawl_thread;
|
||||
BeesThread m_writeback_thread;
|
||||
|
Reference in New Issue
Block a user