mirror of
https://github.com/Zygo/bees.git
synced 2025-05-18 05:45:45 +02:00
bees: initialize context in the correct order
We cannot use BeesContext::roots() until after BeesContext::set_root_path() has been called. Save up the parameter settings until then. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
ac53e50d3e
commit
7283126e5c
12
src/bees.cc
12
src/bees.cc
@ -667,6 +667,7 @@ bees_main(int argc, char *argv[])
|
|||||||
unsigned thread_min = 0;
|
unsigned thread_min = 0;
|
||||||
double load_target = 0;
|
double load_target = 0;
|
||||||
bool workaround_btrfs_send = false;
|
bool workaround_btrfs_send = false;
|
||||||
|
BeesRoots::ScanMode root_scan_mode = BeesRoots::SCAN_MODE_ZERO;
|
||||||
|
|
||||||
// Configure getopt_long
|
// Configure getopt_long
|
||||||
static const struct option long_options[] = {
|
static const struct option long_options[] = {
|
||||||
@ -735,7 +736,7 @@ bees_main(int argc, char *argv[])
|
|||||||
load_target = stod(optarg);
|
load_target = stod(optarg);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
bc->roots()->set_scan_mode(static_cast<BeesRoots::ScanMode>(stoul(optarg)));
|
root_scan_mode = static_cast<BeesRoots::ScanMode>(stoul(optarg));
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
crucible::set_relative_path("");
|
crucible::set_relative_path("");
|
||||||
@ -806,11 +807,16 @@ bees_main(int argc, char *argv[])
|
|||||||
BEESLOGNOTICE("setting worker thread pool maximum size to " << thread_count);
|
BEESLOGNOTICE("setting worker thread pool maximum size to " << thread_count);
|
||||||
TaskMaster::set_thread_count(thread_count);
|
TaskMaster::set_thread_count(thread_count);
|
||||||
|
|
||||||
|
// Set root path
|
||||||
|
string root_path = argv[optind++];
|
||||||
|
BEESLOGNOTICE("setting root path to '" << root_path << "'");
|
||||||
|
bc->set_root_path(root_path);
|
||||||
|
|
||||||
// Workaround for btrfs send
|
// Workaround for btrfs send
|
||||||
bc->roots()->set_workaround_btrfs_send(workaround_btrfs_send);
|
bc->roots()->set_workaround_btrfs_send(workaround_btrfs_send);
|
||||||
|
|
||||||
// Create a context and start crawlers
|
// Set root scan mode
|
||||||
bc->set_root_path(argv[optind++]);
|
bc->roots()->set_scan_mode(root_scan_mode);
|
||||||
|
|
||||||
BeesThread status_thread("status", [&]() {
|
BeesThread status_thread("status", [&]() {
|
||||||
bc->dump_status();
|
bc->dump_status();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user