-
Bug
-
Resolution: Fixed
-
Minor
-
2.3.4, 2.4.1, 2.5, 2.7.3, 2.8.1, 2.9
-
MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MDL-37584-master -
Easy
-
-
Team B Sprint 1
There is a possible performance issue with function notify_login_failures() the first time login failures are checked. If they were never checked previously (e.g. $CFG->notifyloginfailures was not set), $CFG->lastnotifyfailure will be empty. In such a case, the whole log will be checked as per this logic:
if (empty($CFG->lastnotifyfailure)) {
|
$CFG->lastnotifyfailure=0;
|
}
|
If the log is big, this potentially matches thousands of records. Even worse, if the function does not finish (e.g. because connection to DB will time out), $CFG->lastnotifyfailure will never be set to the current date. Hence the same situation will repeat with the next cron run.
As a fix, I would suggest to never check more than (say) 1 last month.
- has been marked as being related by
-
MDL-42891 Reimplement access to log table in functions notify_login_failures() and count_login_failures()
- Closed