Skip to content

Application architecture thoughts #436

@PROger4ever

Description

@PROger4ever

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions