Closed (outdated)
Project:
Recently Read
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
3 Aug 2016 at 19:47 UTC
Updated:
24 Jun 2025 at 11:46 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
aaronbaumanAfter digging into this, it's going to be very expensive to accomplish during cron.
Better to clean up just-in-time, inside recently_read_entity_view()
Comment #3
aaronbaumanderp. typo.
Comment #4
zterry95 commentedAfter digging into this, it's going to be very expensive to accomplish during cron.
Better to clean up just-in-time, inside recently_read_entity_view()
Why it's expensive in cron? I would prefer the clean up the records in cron. like what the watchdog module do.
http://cgit.drupalcode.org/drupal/tree/modules/dblog/dblog.module?h=7.x
Comment #5
aaronbaumanWatchdog can do a very simple query to clean up during cron:
"delete from watchdog where timestamp < $cutoff"
Recently Read needs to do a lot more:
- different limits per entity
- different cutoff time per session, per entity
This makes the procedure up to 2 orders of magnitude more expensive than the watchdog query.
For a sufficiently large site, this could cause significant performance overhead during cron.
pseudo-code:
There are tradeoffs to both approaches, but cleaning up during hook_view seemed cleaner and more efficient to me.
Comment #6
zterry95 commentedAfter think of it, I still prefer to do it on the cron.
in the actual scenario, only a few entity types will be tracked by recently read. so when we clean it in the cron, it's won't be a heavy task.
There are also other benefit by using cron; like we can use elysia_cron or ultimate_cron to do the clean up job, which I think won't cause significant performance overhead during cron.
otherwise, if we check the max_records on hook_entity_view; it will consume the resource on each page view. this will slow down the whole page response in somehow.
Comment #7
aaronbaumanComment #8
Anonymous (not verified) commentedClosing this issue as it's opened against a version of module meant for Drupal 7 which EOL.