When set to "count based" old records never get expunged

Created on 9 January 2024, over 1 year ago

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.

🐛 Bug report
Status

Active

Version

1.3

Component

Code

Created by

🇺🇸United States nathan573 New York

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @nathan573
  • Assigned to samit.310@gmail.com
  • Status changed to Needs work over 1 year ago
  • 🇮🇳India samit.310@gmail.com

    HI @nathan573,

    this issue has been fixed, please review the patch.

    Thanks
    Samit K.

  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • 🇺🇸United States nathan573 New York

    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!

  • First commit to issue fork.
  • First commit to issue fork.
  • Pipeline finished with Success
    3 days ago
    Total: 149s
    #536108
  • Pipeline finished with Success
    3 days ago
    Total: 143s
    #536110
  • Pipeline finished with Success
    3 days ago
    Total: 152s
    #536127
  • Pipeline finished with Success
    3 days ago
    Total: 158s
    #536133
  • Pipeline finished with Success
    3 days ago
    Total: 138s
    #536142
  • 🇸🇮Slovenia deaom

    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.

  • Pipeline finished with Success
    3 days ago
    Total: 157s
    #536153
  • Pipeline finished with Skipped
    2 days ago
    #537167
    • jernejmramor committed 139674bc on 8.x-1.x
      Issue #3413604 by deaom, jernejmramor: When set to "count based" old...
  • 🇸🇮Slovenia jernejmramor

    @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.

Production build 0.71.5 2024