'Backend loop, multiple thread and sessions
I'm currently having some question on how some tools are working. For a product build a test project to connect a database from notion to a twitter account in order to schedule some publication.
I will use OAuth2 and if possible nodeJs for the backend. I've seen that Zappier is doing this but I'm also curious on how to build this tool, so it's also a "improve your knowledge project" but I've some questions that I struggle with.
To retrieve notion database info I need to have a loop like:
Loop every x minutes:
- check for database update
- if there is a new tweet inside the database
- send the tweet to the twitter account related
- update the database status and add a published tag
This is globally the main action that needs to be done.
My questions are:
- How can I loop to all my connected user in an effective maner?
- If I have 400 users and I need to post 400 tweet with a one minute loop I think the second loop will start before the 400 requests might be sent, specially if I await for the answers.
- How to not stop the loop for all my user if one error happen during the loop?
- I can't really think of a solution to have one "thread/process" for each user in order for on loop to run for one user.
- How can I start a new "loop" every time a new user connect, is it a good solution?
- Is node js the best technology to go with?
If you know how zappier is doing it, or if you know or have already done something similar with this kind of isolation or if you know how I can "start" a new loop everytime a new customer connect to the app? any information are welcome.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
