Problem/Motivation
After the user logs out, the JS autologoutGetTimeLeft() function is being called multiple times, generating an excessive amount of logs in the database log (dblog), which is significantly increasing the size of the dblog table when you have lots of users.
Steps to reproduce
1. Set the automatic logout timeout to 1 minute;
2. Clear the Drupal cache;
3. Log in and wait wait until you are automatically logged out by the autologout module;
5. Check the dblog (See the attached image).
Expected Behavior
We expect that the autologoutGetTimeLeft function will not be called multiple times if the user is already logged out, in order to avoid "access denied" logs.
Proposed resolution
I suggest adding the following code to the autologoutGetTimeLeft function in JavaScript. This modification worked for me:
js/autologout.hs
Drupal.Ajax.prototype.autologoutGetTimeLeft = function (callback) {
let ajax = this;
// If an AJAX request is currently running, don't run this one.
// This prevents multiple AJAX requests from running at the same time.
if (ajax.ajaxing) {
return false;
}
// If there is no user, don't make an AJAX request and just redirect.
if (typeof drupalSettings.user === 'undefined') {
return false;
}
(...)
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | autologout_3576757.patch | 874 bytes | edsoncarlos |
| autologout.png | 166.34 KB | edsoncarlos |
Issue fork autologout-3576757
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
edsoncarlos commentedComment #4
edsoncarlos commentedComment #5
edsoncarlos commentedComment #6
edsoncarlos commentedA patch with the proposed solution.
Comment #7
the_g_bomb commentedI suspect this will have been fixed in the recent round of improvements, please retest
Comment #8
the_g_bomb commentedComment #9
the_g_bomb commentedI have tested this with the latest dev branch and suspect the other work done has solved this. Please feel free to reopen and update the steps to reproduce if you are still having problems.
Comment #11
the_g_bomb commentedChanging status to represent the actual status