Kaysoro / KaellyBot

Discord Bot for Dofus game
GNU General Public License v3.0
69 stars 26 forks source link

increase almanax reliability #269

Closed stelzo closed 2 years ago

stelzo commented 2 years ago

Fixes 2 known problems with the Almanax service.

Ankama sometimes changes the offering for the next day but Kaelly serves the old offering. The API will now check every 2 hours if Ankama changed the offering and update the changed entries. Since Kaelly caches the results for 9 days, the chances are high it doesn't update. This is fixed by decreasing the time to live inside the cache to 3 hours. While this increases outside traffic and with that a little bit latency, it can handle short term updates to the Almanax.

Offerings with items unknown to the encyclopedia. This happened on 2021-12-16 and will happen again on 2021-12-25 and 2 more days in the following weeks. The API now searches for a 100% hit in the encyclopedia and if it doesn't find an item, it will serve the mentioned item name on the Almanax site as a backup without meta information. Since the item image depends on the encyclopedia entry, there is also no guarantee for an image so we ignore it in that case. There can be an image url on the Almanax site but that has a high chance of resulting in a 404.

Additional, Kaelly now uses the versioned Almanax API /v1 to be more stable for long term updates.

almanax demo with and without encyclopedia link