MDL-58018 core: add support to database for read-only sessions

This commit is contained in:
Mark Nelson 2020-04-20 14:35:57 +02:00
parent 4400ed3e1c
commit 7daa126d1d

View File

@ -172,7 +172,9 @@ class database extends handler {
}
if (!$this->recordid) {
// Lock session if exists and not already locked.
$this->database->get_session_lock($record->id, $this->acquiretimeout);
if ($this->requires_write_lock()) {
$this->database->get_session_lock($record->id, $this->acquiretimeout);
}
$this->recordid = $record->id;
}
} catch (\dml_sessionwait_exception $ex) {