HomePhabricator

ve.init.mw.Target: Don't go into infinite recursion on API errors

Authored by matmarex.

Description

ve.init.mw.Target: Don't go into infinite recursion on API errors

The #tryWithPreparedCacheKey method was assuming that the request
could only fail because of invalid cache key. It can also fail because
of a bad token, and probably for a number of other reasons.

So only retry only once, and then fail. If it's a 'badtoken' error
during save, the caller will handle it and retry with a working token.
If it's something else, who knows, but we don't go into infinite loop
at least.

Failing in a way that will be handled is weird because 8e48f945 changed
the signatures of the promises, but not the functions that use them.
This must be fixed later.

Bug: T91158
Change-Id: I103cf888d339b44e3fd4fe2376edf5e37ce4157f
(cherry picked from commit 1656d3495ee05a80c94f91451cbe2ce0fcc1e719)