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

Slow down successive exercise execution via debounce #814

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

internaut
Copy link

This adds a new option tutorial.exercise.debounce to slow down successive exercise evaluations.

I've noticed that you can overwhelm a server that hosts a learnr tutorial by repeatedly clicking "Run Code" very quickly in an exercise chunk. On the Linux server that I'm using, this causes learnr to run a new R instance for each evaluation, amounting to hundreds or thousands of instances, depending on how quick you can click and how fast the server can execute and tear down again the R instances.

My fix introduces the use of debounce() when the option is active.

Use options("tutorial.exercise.debounce" = 1000) in a setup chunk of an Rmarkdown document to enable a debounce of 1 sec. The default value is 0, which keeps the behavior currently implemented in learnr (i.e. no debounce).

This is my first contribution here, I'm not quite sure if I've updated the documentation at the correct spot.

PR task list:

  • Update NEWS
  • Update documentation with devtools::document()

@CLAassistant
Copy link

CLAassistant commented May 31, 2024

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

None yet

2 participants