Page MenuHomePhabricator

Add an image: optimize ServiceImageRecommendationProvider::processApiResponseData
Closed, ResolvedPublic

Description

Currently ServiceImageRecommendationProvider::processApiResponseData iterates over all the image suggestions returned by the API and fetches metadata for each suggestion. Since we're currently only showing a single suggestion, iterating over all the suggestions is excessive. Instead, the function could return once we have a single valid suggestion or have reached the specified number of suggestions (in case we do need to support showing multiple suggestions).

For better results, the suggestions should be sorted by confidence (T311291: Image suggestions API: Sort suggestions based on confidence and timestamp)

Event Timeline

kostajh added subscribers: Etonkovidova, kostajh.

We ended up doing this in the task for T312544: Deferred update 'MWCallableUpdate_GrowthExperiments\NewcomerTasks\TaskSetListener->run' failed to run. / rEGREdf7ed6cecda0: AddImage: Only process metadata for a single valid suggestion; sorry that I forgot to tag this task with the patch. I'm not sure that this is easy to QA on its own, so I think it can just be marked as Resolved but I'll let @Etonkovidova decide.

Etonkovidova claimed this task.