Add hybrid method for tutorial storage #518
Open
+208
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hybrid Storage
We discovered when we deployed learnr tutorials to a hosted environment that certain parts of the tutorial would take a long time(30-45 seconds) to initialized. This was because we were using the 'filesystem' option when storing user data and the filesystem was a lot slower as the tutorials got larger and more users accessed it at once. This also provides a fallback if the user deletes their cookies or is blocking them.
Our solution was to combine the client and filesystem methods. This has worked very well for us and we're hoping to contribute it back to the package.
Functions in hybrid_storage are a combination of client and filesystem storage with the exception of get_objects. get_objects includes logic to restore the state in the filesystem to the client storage if there are zero or one items in the client storage.
PR task list:
devtools::document()