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

[Feature]: Handling of concurrent connections to DataStorage #149

Open
1 of 2 tasks
averissimo opened this issue Dec 19, 2023 · 0 comments
Open
1 of 2 tasks

[Feature]: Handling of concurrent connections to DataStorage #149

averissimo opened this issue Dec 19, 2023 · 0 comments

Comments

@averissimo
Copy link
Contributor

averissimo commented Dec 19, 2023

Guidelines

  • I agree to follow this project's Contributing Guidelines.

Description

TODO in the short term:

  • documentation update to reflect this limitation

Add support for concurrent connections in DataStorage backends

In particular, DataStorageLogFile and DataStorageSQLite don't have any mecanism such as file lock.

This might degrade the performance of those backends, which can be counter-acted with implementing #148 to mitigate any impact.

Problem

library(parallel)

log_file <- shiny.telemetry::DataStorageLogFile$new("log_file.txt") # corrupt log file
log_file <- shiny.telemetry::DataStorageSQLite$new("log_db.sqlite") # fails to insert with "Error : database is locked"

log_file$insert(app_name = "yada", session = "fake", type = "text", details = "First write")

mclapply(
  seq(10000),
  \(.x) {
#    log_file <- shiny.telemetry::DataStoragePostgreSQL$new(user = "postgres", password = "mysecretpassword")
    log_file$insert(app_name = "yada", session = "fake", type = "text", details = "I 💙 shiny.telemetry")
#    log_file$close()
  },
  mc.cores = getOption("mc.cores", 8)
)

log_file$read_event_data()

Proposed Solution

  • for ...LogFile: filelock
  • for ...SQLite: TBD

Alternatives Considered

TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant