random-mdn / random-mdn-bot

Serverless functions tweeting/sending/... random MDN articles
MIT License
14 stars 5 forks source link

fix: Restructure fetch logic to avoid extraneous network calls #6

Closed aaronccasanova closed 2 years ago

aaronccasanova commented 2 years ago

This PR moves the Web Documentation URL fetching logic out of the main while loop to avoid extraneous network calls for the MDN sitemap. I'm guessing it's rare the title and description aren't present, which triggers the re-fetch, but it doesn't hurt to optimize the edge case (:

stefanjudis commented 2 years ago

Nice! That's a great optimization. Thanks Aaron!