Conversation
|
I like the idea of this, but it’s kind of expensive because it is going to count every single pokemon in a loop when you call it. another (almost free) approach would be to keep a running total, which could do this per area (since that is already calculated for every new Pokemon). I guess double counting might be a challenge on Pokemon re-encounter though |
|
At the moment the only way to get this info is to use db write of Pokémon table which is way more expensive than calling this endpoint even with hundreds of thousands of Pokémon. |
|
Agreed (or call the scan with a world range and some filters which is equivalent to this but even more expensive) |
|
If the live count is straight forward (we do know it’s a re encounter because of other stats data) and removing a pokemon gets a callback also… so it might be ok… then it could be worth it |
|
Just for context, with 2 million active pokemon that takes 250ms: |
|
During which time there will be contention to all other activities |
|
Ah, actually the problem is that you are using the wrong cache. |
|
Follow up and testing on cache entries I added some debug log lines to get PokemonCache and PokemonLookupCache counts for total, no timer and expired Pokémon and I confirm expired are not cleaned properly (25% of my cache is expired…)
|
|
When did you run this? The expiry looks like it will run the first time after one hour of operation and then continuously afterwards — can you repeat after a while? There may be a way of kickstarting the first run (the library is built to wait an hour when there are no entries to expire it seems) |
|
Ran after 8 hours roughly |
Adds an api endpoint to get count of active pokemon, active with IV, active 100iv and active shiny.
Call with
/api/pokemon/livestatsand response like{"pokemon_active":18853,"pokemon_active_iv":13077,"pokemon_active_100iv":5,"pokemon_active_shiny":56}