Try to make State::set() logic re-usable, directly within CacheCollector::updateCache()

Created on 8 January 2025, 12 days ago

Problem/Motivation

🐛 Race conditions/bad lock logic in CacheCollector/State Active fixes a race condition in State + CacheCollector but relies on a custom ::set() implementation in State.

It may be possible to handle that logic in CacheCollector::updateCache() - e.g. enable it to be called mid-request when setting a value, handle the various lock conditions, merge the new data with the old cache item if there is one and it hasn't changed, and then skip the end of request logic (except possibly as a fallback if it wasn't possible to acquire the lock).

However, this could be as hard to get right as that issue was, especially without breaking bc, so opening as a follow-up.

The main advantage here apart from code re-use would be that it would make it easier for other implementations similar to state to do the same thing, and it might allow for less cache writes / invalidations - by changing the existing cache item when updating underlying information instead of invalidating it.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

📌 Task
Status

Active

Version

11.0 🔥

Component

cache system

Created by

🇬🇧United Kingdom catch

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

Comments & Activities

Production build 0.71.5 2024