1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-17 21:35: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:
Zygo Blaxell 2020-08-31 22:22:57 -04:00
parent 9514b89405
commit 05bd65444d

View File

@ -771,6 +771,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[] = {
@ -839,7 +840,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("");
@ -910,11 +911,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);
// Start crawlers // Start crawlers
bc->start(); bc->start();