Grouping API calls for the better

I’ve made some changes how the BlushyFaceBot makes its calls to the Twitch API (or any other 3rd party API) because of stuffs I’ve been working on lately and I want to keep optimizing the bot for both speed and functionality as much as i can.

Basically the BlushyFaceBot API calls (specifically the Twitch API) are now grouped into one call as much as possible instead of making multiple calls to reduce the amount of connections made as I’ve found out at some point I was making 50+ connections (such as 52.40.65.77 which leaded to amazonaws.com – United States – Amazon Technologies Inc) which was definitely not something i wanted..

So to check what was actually going on, I’ve added a method in the Logger class to log all calls made to Twitch (or any other 3rd party calls) so it’s easier to find out what exactly is going on when debugging and look at what data is actually returned and saves it in a text file.

Logging the json data is optional and enabled when I actually need to check something so the default is disabled and not include the json data to reduce the logging data text file.

So after rewriting some stuff and grouping everything my calls have been reduced significantly as can be seen below.

The image doesn’t show the total connections made during the 30 min testing time frame but needless to say it’s much less than before. I call that a small success.

 

 

 

 

 

 

BlushyFace

BlushyFace

I'm just a BlushyFace | Donate | Patreon
Thank you for supporting me doing this!
BlushyFace

Latest posts by BlushyFace (see all)

Related Post

Liked it? Take a second to support BlushyFace on Patreon!

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz