kalilistic / PlayerTrack

Keep track of players you meet.
MIT License
15 stars 9 forks source link

Lodestone Lookup Returns #147

Closed MikeMatrix closed 6 months ago

MikeMatrix commented 6 months ago

Trying the Lodestone Lookup integration, I noticed that my friend was getting linked to the wrong lodestone ID. I know she swapped names of her characters around (almost a year ago?). This lookup failing causes the plugin to notify me repeatedly of name change events, because her character is being linked to her alt character.

Looking at the code, it seems like the lookup works fine, but the issue lies in the API layer, which probably still caches the result of her previous character.

Characters in Question: https://na.finalfantasyxiv.com/lodestone/character/22776458/ https://na.finalfantasyxiv.com/lodestone/character/20661918/

Trying to request the Players on the API layer, results in the following:

https://api.kalilistic.io/v1/lodestone/player?playerName=Ilse%20Edelweiss&worldName=Ragnarok

{
  "playerName": "Ilse Edelweiss",
  "worldName": "Ragnarok",
  "lodestoneId": "22776458"
}

https://api.kalilistic.io/v1/lodestone/player?playerName=Y%27liyan%20Zhun&worldName=Ragnarok

{
  "playerName": "Y'liyan Zhun",
  "worldName": "Ragnarok",
  "lodestoneId": "22776458"
}

Note that the two lodestoneId returned are Identical.

I assume there is a hard lookup cache on the API where the Playername once it's looked up is getting associated with the Lodestone ID. I think adding a sanity check if the lookup is a certain age, to ensure the player name is still the same might be an idea, but I understand that this will cause a lot of additional requests being sent to lodestone. Maybe a way to manually invalidate the lookup, in case like mine, where the user can notify, that the lookup didn't result in the correct lodestone ID?

kalilistic commented 6 months ago

I've deleted these players from the cache so subsequent lookups should repopulate it with the correct data. As you suspected, there is a cache and a particular player is never looked up again. I'm working on setting up new infra and this will open up more options of cache checks, etc.

MikeMatrix commented 6 months ago

Awesome, appreciate you checking that for me. Hasn't run the update on her yet, but I assume it should work just fine now.