Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use plan(multiprocess). Instead, use plan(multisession) #747

Merged
merged 2 commits into from
Dec 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ plumber 1.0.0.9999 Development version

* Plumber will now display a circular reference if one is found while printing. (#738)

* Changed `future::plan()` from `multiprocess` to `multisession` in example API `14-future` as "Strategy 'multiprocess' is deprecated in future (>= 1.20.0)". (#747)


plumber 1.0.0
--------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions inst/plumber/14-future/plumber.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
library(promises)
library(future)

future::plan("multiprocess") # use all available cores
# future::plan(future::multiprocess(workers = 2)) # only two cores
future::plan("multisession") # a worker for each core
# future::plan(future::multisession(workers = 2)) # only two workers

# Quick manual test:
# Within 10 seconds...
Expand Down
4 changes: 2 additions & 2 deletions inst/plumber/14-future/test-future.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ cat(readLines(log_file), sep = "\n")
}))
# --------------------------

## Sample output using future::plan(future::multiprocess(workers = 2)) # only two cores
## Sample output using future::plan(future::multisession(workers = 2)) # only two workers
# --START route requests
# "/sync; 2019-10-07 13:11:06; pid:82424" - 1
# "/sync; 2019-10-07 13:11:07; pid:82424" - 3
Expand All @@ -88,7 +88,7 @@ cat(readLines(log_file), sep = "\n")

# --------------------------

## Sample output using future::plan("multiprocess") # use all available cores
## Sample output using future::plan("multisession") # a worker for each core
# --START route requests
# "/sync; 2019-10-07 13:16:22; pid:82424" - 1
# "/sync; 2019-10-07 13:16:23; pid:82424" - 3
Expand Down