What's the best practice when using `pool` in a package?
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 255
- Forks
- 33
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 2
Description
For instance, if I need to implement a connection pool within a package, how should I proceed?
Previously, I created pool::dbPool() in the .onLoad() function and closed it with reg.finalizer(), which worked well. However, adding more data sources would clutter the .onLoad() function. Also, how can I establish a connection to the database only when it's needed for the first time?
Furthermore, if I invoke the following function multiple times, will it create multiple connections in a single pool, or will it create multiple pools?
con <- function() {
pool::dbPool(odbc::odbc(), driver = "Oracle Instant Client", dbq = "xxx", uid = "xxx", pwd = "xxx")
}
What would be the best approach in this scenario, or is there an example package that addresses this?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the package's existing pool::dbPool(), .onLoad(), and reg.finalizer() usage, then investigate how repeated calls affect pools and connections. A useful outcome would be a decided, documented package pattern for lazy initialization and cleanup; no files or tests are named.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100