WCF icon indicating copy to clipboard operation
WCF copied to clipboard

`ReactionHandler::cacheLikeableObjects()` sometimes fetches the same data again

Open dtdesign opened this issue 3 months ago • 1 comments

The reaction system requires information about the objects being reacted to which is handled through the dedicated object types. This has the side effect of causing the same data to be read twice, an example:

  1. A list of comments should be shown, fetching the comments and responses.
  2. The reactions are read for these comments.
  3. The comments for these reactions are fetched by their primary key.
  4. The reactions for any responses are read.
  5. The responses are now fetched too, again by their primary key.

As a result the comments and responses with reactions are effectively fetched twice.

This is alleviated in some implementations like \wbb\data\post\LikeablePostProvider because it relies on the runtime cache to provide the objects. This is currently missing for comments and responses, possibly other implementations are impacted too.

dtdesign avatar Sep 01 '25 10:09 dtdesign

Postponed to 6.3 because this can be easily solved through the introduction of additional runtime caches and collections but requires far more testing than I’m comfortable with at this point. 6.2 is already behind schedule and since these extra reads are hitting the primary index this is somewhat acceptable, after all this issue exists for quite some time already.

dtdesign avatar Oct 07 '25 13:10 dtdesign