-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
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:
- Delay in Email Processing: The recipient receives the email at most one minute + processing time.
- 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.