Page MenuHomePhabricator

WeightedTagsUpdater should indicate success of the update
Closed, ResolvedPublic

Description

In T378983: Add Link recommendation are not being processed by CirrusSearch (November 2024), the Growth team is facing an issue with generating weighted tag updates. Unfortunately, the EventBusWeightedTagsUpdater implementation does not indicate its success status in any way. This information would be very useful, because Growth needs to do two things for each link recommendation generated:

  • Update weighted tags in Search
  • Add a row to its own database, which has details about the recommendation

Both the search index and the database need to be in sync (within certain bounds). If they are not, issues can happen relatively quickly. In other words, Growth's code needs to ensure that either both updates happen, or none of them.

The update method has the following signature:

public function updateWeightedTags(
	ProperPageIdentity $page,
	string $tagPrefix,
	?array $tagWeights = null,
	?string $trigger = null
): void;

which means the only way to indicate a failure is by throwing an exception. Growth's code handles any possible exception gracefully (and avoids updating its own database should WeightedTagsUpdater throw), but as far as I can see, WeightedTagsUpdater only logs an error if the update didn't go through (because of eg. validation errors), and the caller has no chance to know about that happening.

To avoid the out of sync issue, I propose to either:

  • make WeightedTagsUpdater throw an exception if an update definitely did not go through,
  • change the signature to allow informing the caller about the operation's result

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Gehel triaged this task as High priority.Nov 11 2024, 4:05 PM
Gehel moved this task from needs triage to Current work on the Discovery-Search board.
Gehel edited projects, added Discovery-Search (Current work); removed Discovery-Search.

Change #1089825 had a related patch set uploaded (by Peter Fischer; author: Peter Fischer):

[mediawiki/extensions/CirrusSearch@master] WeightedTagsUpdater: transparently fail if sending an event fails

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

Change #1089825 merged by jenkins-bot:

[mediawiki/extensions/CirrusSearch@master] WeightedTagsUpdater: transparently fail if sending an event fails

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

Thanks for the work on this! Looks like nothing to follow-up from Growth's side. Removing from tracking.