iftechfoundation / ifdb-suggestion-tracker

Bugs and feature requests for a future IFDB update
10 stars 0 forks source link

Avoid querying IFWiki whenever a game page is loaded #273

Open salty-horse opened 3 years ago

salty-horse commented 3 years ago

When a browser loads the game page, it makes an AJAX call to IFDB, which makes an HTTP call to IFWiki, looking for a wiki page for the game in question (based on the first IFDB).

This is done every time a page is loaded, which is unnecessary. As discussed in iftechfoundation/ifdb#123, the result should be cached for a reasonable period of time, and the IFWiki link should be returned as part of the page.

alice-blue commented 3 years ago
  • What is a reasonable period of time for which to save positive/negative results?

I can think of only a few reasons why a previously-existing game page on ifwiki might become unavailable:

Since none of these things happens very often, maybe a positive result gets saved for 6 months or so.

Not sure about how long to save a negative result.

dfabulich commented 1 month ago

I pulled some data on this today.

Therefore, I think it makes sense to have a very long cache time, for positive and negative results.

It might even make sense to do a one-time import, adding IF Wiki links as External links to the 1,322 games that have them, and then stop automatically querying IF Wiki at all. Users could manually add/remove links to IF Wiki if/when new game pages were added to the wiki.

Alternately, if IF Wiki could conveniently dump out a list of its IFIDs (?) we could probably query that once a day / once a week, and use that cache instead of directly pinging IF Wiki all the time.

salty-horse commented 1 month ago

Here's an API call to get all IFID prefixes in IFWiki: https://www.ifwiki.org/api.php?action=query&format=json&pslimit=500&list=prefixsearch&pssearch=IFID

It's in pages of 500, so needs extra calls. Mediawiki documentation.

alice-blue commented 1 month ago

IFWiki is in the process of putting together a new games database now. I'm not sure how that might affect how IFIDs are organized/stored/etc. on IFWiki.