Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application architecture thoughts #436

Open
PROger4ever opened this issue Sep 28, 2024 · 0 comments
Open

Application architecture thoughts #436

PROger4ever opened this issue Sep 28, 2024 · 0 comments

Comments

@PROger4ever
Copy link

PROger4ever commented Sep 28, 2024

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:

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:
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:

  1. Input layer. Receives links from users, checks the user rights, and puts the link info into a message queue like RabbitMQ;
  2. Prepare layer. Gathers video information and sends it to premium or non-premium message queue;
  3. Premium process layer and non-premium process layer. Download video and send a task to "send queue";
  4. 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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant