Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reducing API Requests = Improving xp/hr #3247

Closed
TheSavior opened this issue Aug 9, 2016 · 8 comments
Closed

Reducing API Requests = Improving xp/hr #3247

TheSavior opened this issue Aug 9, 2016 · 8 comments
Labels

Comments

@TheSavior
Copy link
Contributor

Reducing unnecessary api requests is going to have the largest impact on improving xp/hr. I added logs for what API requests we are making. Here is a large amount of output: http://pastebin.com/4dGVasXa

Does anyone see anything that looks like we should be able to remove and speed up?

@aeckert, it seems like inventory management is a big piece we can improve here.

@douglascamata, any additional thoughts?

@eggins
Copy link
Contributor

eggins commented Aug 9, 2016

👍

@BriceSD
Copy link
Contributor

BriceSD commented Aug 9, 2016

@TheSavior What about the gym details we're requesting en though the bot doesn't interact with any of them ?
If it's for getting fort details there is an other api call to make
https://github.com/tejado/pgoapi/wiki/get_gym_details
https://github.com/tejado/pgoapi/wiki/fort_details

@TheSavior
Copy link
Contributor Author

@BriceSD We have removed the calls to the gym_details in this PR (after I created the pastebin): #3245

@BriceSD
Copy link
Contributor

BriceSD commented Aug 9, 2016

Concerning the inventory management I think that every task should track what it consumes/loot. The same way he's already doing it for candies.
This way we could init the iventory at the start of the bot and not havig to call the api again. Might not be very human-like though, I guess that the PokemongGo app is calling the api pretty often.

@douglascamata
Copy link
Member

IMHO, tasks should not "track what it consumes/loot". We need a wrapper to API responses. Tasks shouldn't be aloud to access the raw api object. Instead they should only be allowed to access high-level objects, like a Pokemon object, with proper methods for releasing, for example, that will automatically update the inventory cache when called. This way it's impossible to have an outdated inventory cache and we get simpler tasks as bonus.

@TheSavior
Copy link
Contributor Author

@douglascamata That sounds great to me. That would keep us from getting into a situation where a task doesn't update the inventory correctly and messes everything up.

@BriceSD
Copy link
Contributor

BriceSD commented Aug 9, 2016

@douglascamata Like having a class PokemonAPI containing every (and only) api call related to pokemons ?

Hiding the inventory update from tasks seems great. The additional abstraction should also protect our bot from changes of the api too, which is always good to take imo.

@douglascamata
Copy link
Member

@BriceSD yup, a bit like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants