Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.3.4, 2.4.1, 2.5, 2.7.3, 2.8.1, 2.9
-
Component/s: Performance
-
Testing Instructions:
-
Difficulty:Easy
-
Affected Branches:MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE, MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
-
Fixed Branches:MOODLE_27_STABLE, MOODLE_28_STABLE
-
Pull from Repository:
-
Pull Master Branch:
MDL-37584-master -
Pull Master Diff URL:
-
Sprint:Team B Sprint 1
Description
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.
Attachments
Issue Links
- has been marked as being related by
-
MDL-42891 Reimplement access to log table in functions notify_login_failures() and count_login_failures()
-
- Closed
-