A
A
Alexander2021-09-29 15:31:20
Python
Alexander, 2021-09-29 15:31:20

How to properly organize the structure of the interaction of two scripts?

Good afternoon, I have a aiogram bot that inserts survey results into Google spreadsheets. Now the structure is like this, the bot collects the user's answers and saves the questions to the database. The second script is written through an infinite loop and launched using supervisorctl, it checks the table for new data and writes them one by one to Google Spreadsheets. The question is, is this the right approach? Or are there any technologies, libraries that allow you to create a task while saving data in the database, and these tasks will be processed in turn (in order of receipt), so as not to produce different scripts, but to use everything in one place in the bot?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Shubin, 2021-09-29
@idegree

There are such technologies. In python, multithreading or asynchrony can help with this. Then everything will work for you in one process. Another thing is that from the point of view of scalability, a solution with different scripts can be better.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question