api: don't refresh cache mtime after failed JSON download
When fetch_json_api_file's curl_download raised ErrorDuringExecution and fell back to the cached version, the code unconditionally touched the cache file with the current mtime. On the next `brew upgrade`, `skip_download?` saw a 'fresh' mtime and short-circuited the download entirely, so brew kept reusing the stale formula.jws.json / cask.jws.json until `brew cleanup` removed it. Track `download_succeeded` and only refresh the cache mtime after a successful curl revalidation/download. Reset the flag at the top of the retried outer `begin` so a JSON::ParserError-triggered retry cannot inherit a stale `true` from the previous attempt. Closes #22089
R
RtYkk committed
3c1bf23f0c1d8e8bc3f8ff85de64367c81229118
Parent: cc2848a