Ghost/ghost/core/test/e2e-frontend
Chris Raible 971d497c1e
Added caching to LastSeenAtUpdater (#20964)
ref
https://linear.app/tryghost/issue/ENG-1543/debounce-the-members-lastseenatupdater

- The `LastSeenAtUpdater.updateLastSeenAt` function is called in
response to a `MemberClickEvent` — when a member clicks a link in an
email with tracking enabled. This function can be called many times for
the same member in a short period of time if e.g. a link checker is
clicking all the links in an email they received.
- This function should only update a member's `last_seen_at` timestamp
once per day. To accomplish this, `updateLastSeenAt` runs a
`select...for update` query to find the member's current `last_seen_at`
timestamp, and only updates the timestamp if the current `last_seen_at`
is before the start of the current day. The `for update` is required to
avoid a race condition, which previously caused this function to update
the `last_seen_at` timestamp more frequently than needed, which results
in many unnecessary database queries. However, we still run the initial
`select...for update` query for each event, which seems to be resulting
in contention for locks on the member's row in the `members` table.
- This commit introduces a simple in-memory cache so that we avoid
calling `updateLastSeenAt` if the member's `last_seen_at` timestamp has
already been updated in the current day, which should avoid running so
many `select...for update` queries and locking the `members` table up.
2024-09-13 00:54:43 -07:00
..
helpers Fixed get helper cache optimizations (#19865) 2024-03-15 00:18:15 +07:00
advanced_url_config.test.js Prevent simple error logs by stubbing log library 2023-03-03 18:25:53 +00:00
custom_routes.test.js Revert "🐛 Fixed frontend routing prioritizing collections over built in routes (#20765)" 2024-08-27 18:04:27 +02:00
default_routes.test.js 🐛 Fixed Content-Type for RSS feed (#20670) 2024-08-07 12:09:54 +02:00
email_routes.test.js Removed all unused variables from test files 2023-03-10 14:29:55 +01:00
member_stats.test.js Removed all unused variables from test files 2023-03-10 14:29:55 +01:00
members.test.js Added caching to LastSeenAtUpdater (#20964) 2024-09-13 00:54:43 -07:00
middleware.test.js 🐛 Fixed redundant member data loading for static assets (#20031) 2024-05-20 13:55:45 +08:00
preview_routes.test.js 🐛 Fixed broken access to preview of scheduled email-only posts (#19539) 2024-01-22 14:20:50 +00:00
site_id_middleware.test.js Added middleware to prevent other sites' content from being served (#20922) 2024-09-05 17:15:09 +01:00
static-files.test.js 🐛 Fixed missing source + resized images producing rendered 404 (#19869) 2024-03-18 18:32:10 +01:00