Problem/Motivation

recently_read table gets very large with sites that have primarily anonymous traffic when "Records delete options" is set to "Count based". Despite the notice that "Older records will be removed" there doesn't seem to be a provision for this to happen in the module code.

Proposed resolution

Add a cron task that deletes old records or maybe the "count based" option to limit the number of records per user/session should be de-coupled from the process that deletes records based on how old they are. Perhaps this should be broken out into two different settings:
"Delete old records" (with the time intervals as a setting or "never") and "Records per user or session" (with the setting being the number of records to limit the user/session to)

This way a record age-limit can be configured independent of the user/session record limit.

CommentFileSizeAuthor
#3 3413604-3.patch828 bytessamitk
Command icon 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

nathan573 created an issue. See original summary.

samitk’s picture

Assigned: Unassigned » samitk
Status: Active » Needs work
samitk’s picture

Assigned: samitk » Unassigned
Status: Needs work » Needs review
StatusFileSize
new828 bytes

HI @nathan573,

this issue has been fixed, please review the patch.

Thanks
Samit K.

samitk’s picture

nathan573’s picture

Thank you very much samit.310@gmail.com! I've tested this patch out for at least a month now and it's working.

Cheers!

Anonymous’s picture

jernejmramor made their first commit to this issue’s fork.

deaom made their first commit to this issue’s fork.

deaom’s picture

The MR is different from the provided patch as it adds the additional option for anonymous users if Count based is selected. Hiding that file.
Tested the functionality manually:

  1. selected count based
  2. set Max records 1 and 2
  3. set the delete anonymous records after 1 hour
  4. created two content types that are tracked
  5. visited as logged in user and as anonymous use
  6. checked that the record in DB correctly stores only 1 record when 1 was set up and 2 when max was set to 2
  7. came back after the hour has passed and checked that the anonymous records were removed but the logged in one stayed.

Functionality works as expected.

I changed the naming of 1 hours to 1 hour, updated phpcs indentation, renamed enitity to entity and ignored basetable (cSpell reported as an issue) and added cSpell ignore to readme for maintainers.

As the review was also requested to be done by @bostian, leaving the status to needs review, but from my POV, it can be merged.

  • jernejmramor committed 139674bc on 8.x-1.x
    Issue #3413604 by deaom, jernejmramor: When set to "count based" old...
Anonymous’s picture

Version: 8.x-1.3 » 8.x-1.x-dev
Assigned: Unassigned »
Status: Needs review » Fixed

@deaom I've requested review from @boshtian because I wanted someone to review my work prior to merging. Since you've tested and reviewed work done I think that additional reviews aren't needed so I'm marking this as Fixed, and will include this issue into next release. After release is published I will close this ticket.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.