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

Unncessary session locks in ajax.php #722

Open
marxjohnson opened this issue Apr 11, 2024 · 1 comment
Open

Unncessary session locks in ajax.php #722

marxjohnson opened this issue Apr 11, 2024 · 1 comment

Comments

@marxjohnson
Copy link

While doing some log analysis for a large Moodle site with session lock debugging enabled, I noticed a large proportion of the messages about long session locks came from mod/turnitintooltwo/ajax.php. For locks lasting more than 1 second, this script accounted for about 75%. For those lasting more than 3 seconds, 33%, and those lasting more than 5 seconds, 15%.

I took a loot at this script, and while some of the actions is provides do alter the session, most do not, so do not need to hold a session lock for the whole request.

This can be improved by releasing the session lock if it will not be needed, by adding the following after $action = optional_param():

if (!in_array($action, ['sync_all_submissions', 'get_submissions'])) {
    // No changes will be made to the session.
    \core\session\manager::write_close();
}
@aspark21
Copy link
Contributor

this one also worth implementing @carl-hostrander

It will probably provide inspiration for turnitin/moodle-plagiarism_turnitin#503

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

No branches or pull requests

3 participants