Okay, this one took me a bit longer than I planned (mostly due to sql fun and trying to use integers as minutes, WEEEE!).
Backdrop: Last week I disabled the mirroring of a couple of subreddits to the database, because they were initially requested but the nobody subscribed to them. At the same time, the bot was just crawling in a loop, starting at todayilearned
, ending at latestsubreddit
. As more subreddits were requested, this loop took longer and longer (21 minutes before I rolled out this update). This wasn’t sustainable.
So here’s the new situation. The more popular a community is, the more often it will be updated. In this case popular means a mixture between number of subscribers and the amount of posts it receives per day (Link to relevant snippet of source code).
In short, the most popular subs will be synced every 10 minutes, the next tier ever 30 minutes, 120 minutes and the content with either no posts per day or no subscribers (other than the bot), will only be synced every 12 hours. I hope this will hit a good distribution of updates vs popularity, but it will most likely be refined at some point in the future.
Speaking of distribution, we now have over 300 communities on this server 🥳, and their update intervals are spread out as such:
- Every 10 minutes: 22
- Every 30 minutes: 39
- Every 60 minutes: 55
- Every 120 minutes: 143
- Every 720 minutes: 44
With this update running live (I started typing after I deployed it, and it has now gotten through the backlog of ‘abandoned’ subs), I’m going to step back from feature development for a few days. Any bugs that cause the bot to crash will of course continue to be addressed.
Have a blast!