Skip to content

Support for Defining Continuous Python Processes #1601

@s-aga-r

Description

@s-aga-r

Use Case
In Frappe Mail, incoming emails are pushed to RabbitMQ and later processed by a scheduled job that runs every minute. This approach has two significant drawbacks:

  1. Delay in Email Processing: The recipient receives the email at most one minute + processing time.
  2. Redundant Job Execution: Even if no emails are in the queue, the scheduled job runs unnecessarily.

How This is Handled in Mail Agent
In the Mail Agent (a core Python application), a Procfile is generated to define processes directly connecting to RabbitMQ and working as continuous consumers. This ensures real-time processing without delays and avoids redundant job executions.

Proposed Feature
A similar feature can be implemented in the Frappe framework. App developers could define Python processes to start when bench start is executed. These processes would run continuously until bench stops and could be used to handle real-time tasks, like consuming a RabbitMQ queue or any other long-running operations.

Key Benefits:

  • Real-time processing for time-critical tasks.
  • Avoids redundant job executions, saving resources.
  • Bench could manage these processes, ensuring they restart automatically if they terminate unexpectedly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions