-
-
Notifications
You must be signed in to change notification settings - Fork 593
Open
Description
Current application architecture problems
There are a lot of points in the code which do almost the same but in a different way.
For example, here is how non-premium message is composed:
Line 641 in 324b18d
| f"{user_info}\n{file_name}\n\n{url_for_cap}\n\nInfo: {meta['width']}x{meta['height']} {file_size}\t" |
And here is how premium message is composed:
Line 71 in 324b18d
| caption = "Powered by @benny_ytdlbot " |
The purpose of this action is the same - to prepare a description message for a sending video, but code implementations are different and placed in 2 separate files.
Proposal
I don't think this should be implemented ASAP, but we should think about it.
A proper way to implement such complex applications is to divide the code into layers or even into (micro)services like:
- Input layer. Receives links from users, checks the user rights, and puts the link info into a message queue like RabbitMQ;
- Prepare layer. Gathers video information and sends it to premium or non-premium message queue;
- Premium process layer and non-premium process layer. Download video and send a task to "send queue";
- Send layer. Prepares and sends messages to telegram-users.
This architecture allows us to divide the application complexity and send the same message regardless of whether it's premium-download or not :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels