Skip to content

Refactoring V1 #1

Description

@moalimir
  1. General
  • Dependency Audit: The torch and torchvision versions specified in requirements.txt should be reviewed for compatibility with facenet-pytorch, and a more flexible versioning scheme should be considered.

  • Configuration Validation: Implement a uniform and user-friendly approach to validate and handle missing .env variables across all scripts to prevent crashes.

  1. bot.py
  • Improve Error Handling: Refactor the broad try...except block in the continue_find callback function to use more specific exception handling for better user feedback and logging.
  • Fix Memory Leak: Implement a cleanup mechanism for the media_group_locks dictionary to prevent a memory leak from unprocessed media groups over time.
  • Address Race Condition: Re-evaluate and strengthen the media group handling logic to make the process of sending a button for the first image of a group more robust and prevent potential race conditions.
  1. downloader.py
  • Make Session Name Configurable: The hardcoded client session name "my_account" should be moved to the .env file to be configurable.
  • Enhance Error Handling: Add a retry mechanism for generic network errors, in addition to the existing handling for FloodWait, to make the download process more resilient.
  1. indexer.py
  • Simplify Configuration: The logic for determining the output file path should be simplified to use a single, explicit environment variable instead of relying on multiple, potentially confusing fallbacks.
  • Handle Embedding Collisions: Investigate the cause of embedding collisions and implement a more robust strategy than simply overwriting the existing entry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions