1
0
mirror of https://github.com/Zygo/bees.git synced 2025-08-04 14:53:28 +02:00

crawl: don't block a Task waiting for new transids

Task should not block for extended periods of time.

Remove the RateEstimator::wait_for() in crawl_roots.  When crawl_roots
runs out of data, let the last crawl_task end without rescheduling.
Schedule crawl_task again on transid polls if it was not already running.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2018-01-28 22:07:45 -05:00
parent b67fba0acd
commit 4f0bc78a4c
2 changed files with 35 additions and 21 deletions

View File

@@ -9,8 +9,9 @@
#include "crucible/fs.h"
#include "crucible/lockset.h"
#include "crucible/time.h"
#include "crucible/task.h"
#include <array>
#include <atomic>
#include <functional>
#include <list>
#include <mutex>
@@ -528,6 +529,8 @@ class BeesRoots : public enable_shared_from_this<BeesRoots> {
BeesThread m_writeback_thread;
RateEstimator m_transid_re;
size_t m_transid_factor = BEES_TRANSID_FACTOR;
atomic<bool> m_task_running;
Task m_crawl_task;
void insert_new_crawl();
void insert_root(const BeesCrawlState &bcs);
@@ -538,7 +541,7 @@ class BeesRoots : public enable_shared_from_this<BeesRoots> {
uint64_t transid_max_nocache();
void state_load();
void state_save();
void crawl_roots();
bool crawl_roots();
string crawl_state_filename() const;
BeesCrawlState crawl_state_get(uint64_t root);
void crawl_state_set_dirty();