Skip to content

Commit 23a4fff

Browse files
committed
Improved various options checks and warning messages
1 parent 72e0726 commit 23a4fff

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

src/options.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,17 @@ options_t::options_t(int argc, char *argv[]) : options_t()
556556
break;
557557
case 205:
558558
num_procs = atoi(optarg);
559+
if (num_procs < 1) {
560+
log_warn("--number-processes must be at least 1. Using 1.");
561+
num_procs = 1;
562+
} else if (num_procs > 32) {
563+
// The threads will open up database connections which will
564+
// run out at some point. It depends on the number of tables
565+
// how many connections there are. The number 32 is way beyond
566+
// anything that will make sense here.
567+
log_warn("--number-processes too large. Set to 32.");
568+
num_procs = 32;
569+
}
559570
break;
560571
case 206:
561572
droptemp = true;
@@ -706,7 +717,8 @@ void options_t::check_options()
706717

707718
if (enable_hstore_index && hstore_mode == hstore_column::none &&
708719
hstore_columns.empty()) {
709-
log_warn("--hstore-add-index only makes sense with hstore enabled.");
720+
log_warn("--hstore-add-index only makes sense with hstore enabled; "
721+
"ignored.");
710722
enable_hstore_index = false;
711723
}
712724

@@ -726,24 +738,14 @@ void options_t::check_options()
726738
}
727739
}
728740

729-
if (num_procs < 1) {
730-
num_procs = 1;
731-
log_warn("Must use at least 1 process.");
732-
}
733-
734-
if (sizeof(int *) == 4 && !slim) {
735-
log_warn(
736-
"This is a 32bit system with not a lot of RAM. Try using --slim.");
737-
}
738-
739741
// zoom level 31 is the technical limit because we use 32-bit integers for the x and y index of a tile ID
740-
if (expire_tiles_zoom_min >= 32) {
742+
if (expire_tiles_zoom_min > 31) {
741743
expire_tiles_zoom_min = 31;
742744
log_warn("Minimum zoom level for tile expiry is too "
743745
"large and has been set to 31.");
744746
}
745747

746-
if (expire_tiles_zoom >= 32) {
748+
if (expire_tiles_zoom > 31) {
747749
expire_tiles_zoom = 31;
748750
log_warn("Maximum zoom level for tile expiry is too "
749751
"large and has been set to 31.");

0 commit comments

Comments
 (0)