You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello - found some potential performance problems if this plugin was used on a very active site:
In auth_plugin_googleoauth2::get_stats function, the query to auth_googleoauth2_logins table could return a lot of records. An improvement would be to use a count SQL query, EG: SELECT subtype, COUNT(id) logins FROM {auth_googleoauth2_logins} WHERE time > :time GROUP BY subtype and the subtype that is null would be for your moodle logins. Think you would have to use get_recordset_sql to run that SQL as get_records_sql likely wouldn't like the null subtype.
In the auth_googleoauth2_observer, ideally the get_record on user table just pulls down their auth field instead of the whole record, EG: use $DB->get_field(...) instead. You might be able to get away with using $USER global as well and avoid the DB read altogether.
The auth_googleoauth2_logins table is never cleaned, so could get quite large over time. I would suggest adding a scheduled task to delete old records. Would probably look very similar to \logstore_standard\task\cleanup_task.
Adding an index to the time column on the auth_googleoauth2_logins table would really improve query performance once the table size gets larger.
Please let me know if anything is unclear, cheers!
The text was updated successfully, but these errors were encountered:
Hello - found some potential performance problems if this plugin was used on a very active site:
auth_plugin_googleoauth2::get_stats
function, the query toauth_googleoauth2_logins
table could return a lot of records. An improvement would be to use a count SQL query, EG:SELECT subtype, COUNT(id) logins FROM {auth_googleoauth2_logins} WHERE time > :time GROUP BY subtype
and thesubtype
that isnull
would be for yourmoodle
logins. Think you would have to useget_recordset_sql
to run that SQL asget_records_sql
likely wouldn't like thenull
subtype.get_record
onuser
table just pulls down their auth field instead of the whole record, EG: use$DB->get_field(...)
instead. You might be able to get away with using$USER
global as well and avoid the DB read altogether.auth_googleoauth2_logins
table is never cleaned, so could get quite large over time. I would suggest adding a scheduled task to delete old records. Would probably look very similar to\logstore_standard\task\cleanup_task
.time
column on theauth_googleoauth2_logins
table would really improve query performance once the table size gets larger.Please let me know if anything is unclear, cheers!
The text was updated successfully, but these errors were encountered: