-
Bug
-
Resolution: Fixed
-
Minor
-
4.0.5, 4.0.8, 4.1, 4.1.3, 4.2
Suppose we have a client platform and a server platform.
On the client platform we create a course, enroll a student (JOHN SMITH), create a lti activity pointing to the server platform.
We log into the client platform with the student and use the lti activity. Let's move to the server platform and launch the task \enrol_lti\local\ltiadvantage\task\sync_members.
On first run it will synchronize the user on the server with the user on the client by updating the user, and that's OK.
NOW ATTENTION: FROM THE NEXT RUN, EVEN IF NOTHING HAS CHANGED, USER JOHN SMITH WILL CONTINUE TO UPDATE TWICE.
CONSEQUENCES: the user_updated event will be triggered 2 times writing 2 records in the log table. If we think of a platform with thousands of lti users with an average of N tools per user, if this task runs every half hour (as by default), hundreds of thousands of records will be written every day up to a few million (as in our case) of records in the log table.
The database grows exponentially (in our case about 1GB per day).
We have analyzed the code and we think that a check could be inserted to verify that the user record actually needs to be updated (and not just for timemodified as it happens now). There would actually be 2 checks as the update is done 2 times: one in the auth/lti/auth.php file around line 380 before calling the user_update_user($update) function and the second in the enrol\lti\classes file \local\ltiadvantage\repository\user_repository.php before calling the same function as before on line 167 (function save).
I apologize in advance if something is not clear but the concept is complex, I am available for clarification.