Page MenuHomePhabricator

Load only extended metadata when needed
Closed, ResolvedPublic

Description

We learned recently that getting extended metadata from Commons is particularly expensive and unlikely to be already cached. We have been noticing the Commons image search API being slow for some time and that is the most likely culprit.

We should delay getting the extended metadata for images until they have been selected for a story or even not at all since the author, license and page links are re-fetched in the backend anyway and not at all critical for the builder experience.

Related Objects

Event Timeline

let's make it into two steps to speed up the builder experience:

(1) remove the additional extended metadata fetch from builder;
(2) fetch extended metadata only when user select from the list;

with the extmetadata

image.png (152×834 px, 13 KB)

without the extmetadata

image.png (127×857 px, 13 KB)

we only see few difference on size;
timewise doesn't seem too much difference;


wait, we can actually remove the second imageinfo to reduce 2 seconds in this case.

@hueitan the issue with extended metadata is that it's unlikely to be in cache and it takes a while to generate. It stays in cache for the Dog search query since you keep asking for it so you won't see a difference but as soon as you start typing a less common search string, new images will be found and the metadata will have to be computed.

We need the second imageinfo to be able to filter images from the article on size (remove those smaller than 640x640).

Change 815912 had a related patch set uploaded (by Huei Tan; author: Huei Tan):

[mediawiki/extensions/Wikistories@master] Load only extended metadata when needed

https://gerrit.wikimedia.org/r/815912

SBisson triaged this task as Medium priority.Jul 21 2022, 2:19 PM

Change 815912 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] Load only extended metadata when needed

https://gerrit.wikimedia.org/r/815912

EUdoh-WMF subscribed.

Regression testing around image search, attributions display and story creation don't show any break in functionality.