Skip to content

Commit

Permalink
remove max_cap requirement, add message
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Oct 6, 2023
1 parent 5527802 commit 030b240
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions R/options.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ polars_optreq$rpool_cap = list(
# allow 2 instead of 2L, but doesn't allow 2.5
must_be_integer = \(x) {
all(!is.na(x) & is.numeric(x) & x == round(x))
},
must_be_smaller_than_max = \(x) {
max_cap = polars_optenv$rpool_cap_max
all(x <= max_cap)
}
)

Expand Down Expand Up @@ -141,6 +137,9 @@ pl$set_options = function(
assign(args_modified[i], value, envir = polars_optenv)

if (args_modified[i] == "rpool_cap") {
if (value > polars_optenv$rpool_cap_max) {
message("Setting `rpool_cap` above the default value will likely not generate major speedup.")
}
set_global_rpool_cap(value) |>
unwrap() |>
invisible()
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-rbackground.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ test_that("reset rpool_cap", {

test_that("rpool errors", {
rpool_cap_max = pl$options$rpool_cap_max
expect_error(
expect_message(
pl$set_options(rpool_cap = rpool_cap_max + 1),
"must be smaller than the maximum capacity"
"above the default value"
)
expect_error(
pl$set_options(rpool_cap = c(1, 2)),
Expand Down

0 comments on commit 030b240

Please sign in to comment.