40Cakes / pokebot-gen3

PokéBot Gen3 is a shiny hunting bot, written in Python that runs libmgba + mGBA Python bindings under the hood. Pokémon Ruby, Sapphire, Emerald, FireRed and LeafGreen are supported.
https://www.youtube.com/@40_Cakes/streams
GNU General Public License v3.0
178 stars 54 forks source link

Fix HTTP API hanging on consecutive calls #333

Closed hanzi closed 4 months ago

hanzi commented 4 months ago

Description

When doing multiple HTTP API calls to the /items endpoint in particular, there was a good chance for the HTTP thread to hang in an infinite loop.

The reason for this was that the HTTP API would issue an update instruction to the main thread and then wait for the data's age_in_seconds to update -- but this would only change if the underlying value (i.e. the item bag/PC storage) changed.

Instead, we now check age_in_frames which updates every time the value is checked even if it didn't change.

Fixes #325

Checklist