TibiaJS / tibia-crawler-legacy

[OUTDATED] Parse tibia website data like a sir.
7 stars 1 forks source link

Cache worlds list to check #9

Open renatorib opened 9 years ago

renatorib commented 9 years ago

All highscores calls result in two tibia.com requests, one for check world, other to get highscore. We can reduce execution time in 50% caching worlds list from worlds and when need to check if a world exists, check in this array. Considering that it is not normal to have new worlds, we can cache for 24 hours or more.

gpedro commented 9 years ago

:+1:

we love PR

renatorib commented 9 years ago

I can do it later if I have free time.

ranisalt commented 9 years ago

I see no point in caching the results. This is how a crawler works, always get the bleeding edge data even if it doesn't change for a long period. But I think there is a problem in making those double requests, we can skip the first (to check if the world exists) and just try to get the world highscores, and let it scream if the world doesn't exists normally. What do you think?

PS: Whoever made this highscore function got it completely out of code style standards, please fix it.