paquettg / leaguewrap

League of Legend API wrapper
MIT License
67 stars 28 forks source link

GetChampion query taking too much time #123

Closed musaghauri closed 8 years ago

musaghauri commented 8 years ago

$api->staticData()->getChampion($item['championId'],'tags')->raw()['tags'][0]; The above call is used to getchapion's first tag! This query is unexpectedly taking 5 to 6 seconds for each champion! Can you suggest me a way or any other function to reduce the time! This is making me tak 5 to 6 minutes for a player who has 40+ champions!

dnlbauer commented 8 years ago

The lib can't do much on how long network request take. This depends only on your network and the status of riots api.

Right now you are doing one separate network request per champion. I suggest you do one request to fetch the data of all champions together once and then cache that somewhere and reuse it.

Muhammad Musa notifications@github.com schrieb am Do., 20. Okt. 2016, 09:58:

$api->staticData()->getChampion($item['championId'],'tags')->raw()['tags'][0]; The above call is used to getchapion's first tag! This query is unexpectedly taking 5 to 6 seconds for each champion! Can you suggest me a way or any other function to reduce the time! This is making me tak 5 to 6 minutes for a player who has 40+ champions!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/paquettg/leaguewrap/issues/123, or mute the thread https://github.com/notifications/unsubscribe-auth/AEeQ8jbzTM03ZmaajPteVwgTIwvYB6mGks5q1x8ngaJpZM4Kb0wl .

musaghauri commented 8 years ago

Thanks for your reply! Amazing approach! Worked like a charm! :)