I’ve built a trading platform using Ktor and coroutines. This is my first experience with coroutines, and I’m pretty sure I’ve made some naive mistakes. This is what my logging activity looks like, and I have no idea why. I’ve obviously baked in these pauses, but I don’t know how.
If you’re experienced with coroutines, what would you look for to get to the bottom of this behavior? What would you have to do to make this happen? Should I be looking for async/await or something else? It almost seems like thread starvation. or some other kind of deadlock, but I don’t understand how it is so regular or such large blocks of time.
I am continuously consuming market data, 23 hours per day. As far as scheduled events, I send a status email at the top of every hour, and every 12 minutes I refresh access tokens. The obvious culprit seems like the 12-minute cycle, but it’s far from obvious in the logs that they are related. I can’t find any clear association between the beginning or end of the token refresh with the idle period or the busy period.
I’m going to change the refresh token period to see if the nature of the cycles changes, but, while I’m gathering that data, what should I be looking for that could cause this?