Hello,
I am sending notification to my users depending on what kind of subscription each user has.
For example:
User A
subscribed to all news articlesUser B
subscribed to all commentsUser C
subscribed to everything that is new on the site
I have a script running every 5 minutes (unless the script is still running) who does the following:
- Get new "content" (comments, news articles, etc) posted since the last run
- For each result, fetch each users who subscribed to "content"
- For each users, sends a notification
What I'm concerned with is, if I have a 1,000 new "content" and my users are subscribe to 50% of it, my script will take forever to finish or will crash my server.
What I come up with is to select only 100 new "content" per run and notify the users. I still have the problem of the amount of users that can be subscribed to it.
Than I thought, I could limit the amount of users I select also to 100, than iterate until I reach all users.
Is this the right approach? Is there an easier way to do this? How does large websites handle their users notifications?