-
Bug
-
Resolution: Fixed
-
Minor
-
3.5.5, 3.6.3, 3.7
-
MOODLE_35_STABLE, MOODLE_36_STABLE, MOODLE_37_STABLE
-
MOODLE_35_STABLE, MOODLE_36_STABLE
-
MDL-65179-master -
The 'last access' time on external tokens is updated every time that a token is used. This was probably OK when web services were first implemented but is not so good when using the mobile app.
For example, when a user connects with the mobile app, it may make ~20 web service requests within a few seconds, many of them simultaneously. This will cause the external_tokens table to be updated 20 times. In some of those cases it may be the same second so the update won't even change anything.
This is a slight performance problem because databases have to do a lot of work each time the table is updated.
I propose changing so that it only updates once per minute, which will reduce the number of database writes significantly. In the case of logging into the web app, this would mean the table gets updated 1 time instead of 20 times. There may also be slight improvements while continuing to use the mobile app.
There is already code that does the same thing for the user_lastaccess table, via the LASTACCESS_UPDATE_SECS global define (also set to 60) so this is analagous.