I'm creating a small service where I poll around 100 accounts (in a Twitter-like service) frequently (every 5 seconds or so) to check for new messages, as the service doesn't yet provide a streaming API (like Twitter actually does).
In my head, I have the architecture planned as queuing Ticker
s every 5 seconds for every user. Once the tick fires I make an API call to the service, check their messages, and call SELECT
to my Postgres database to get the specific user details and check the date of the most recent message, and if there are messages newer than that UPDATE
the entry and notify the user. Repeat ad nauseum.
I'm not very experienced in backend things and architecture, so I want to make sure this isn't an absolutely absurd setup. Is the amount of calls to the database sensible? Am I abusing goroutines?