Problem with bot handling a points system

I don’t use Golang or SQLite so I’m not familiar with optimisation for them, but from my experience doing analytics and working with large channels it’s just one of those things that you’re going to have to accept that working with large arrays of users, and doing big inserts/updates for a points system, can use a lot of resources.

It’s worth doing some monitoring to see where the issues are for you and track the impact changes make. For example in my setup I found when my channels start hitting ~40k viewers MongoDB was having issue with such a big update, so I set it up to split it up into multiple updates and that improved performance somewhat.

On top of that you can also trade off real-time accuracy with your points system with reduced DB updates by buffering multiple updates and doing it at once, eg if you give out points at a 5 minute interval, buffer the points and update the db every 10, 15, or 30, minutes. Or if DB operations are not as much of an issue as the API request itself and handling that data, it’s not always possible to reduce that if the channel happens to have a lot of chatters, but you can reduce the frequency of requests and just increments points less often.

Also, I’m not sure what you’re making a request to https://api.twitch.tv/helix/users?login=channelid, is this just to get a chatters ID? If so, I hope you’re caching results so that you’re only requesting that on a cache miss, as if you already have that data cached there’s no point calling it again, at least not in the context of a points system.