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

Support for Defining Continuous Python Processes #1601

Open
s-aga-r opened this issue Nov 26, 2024 · 0 comments
Open

Support for Defining Continuous Python Processes #1601

s-aga-r opened this issue Nov 26, 2024 · 0 comments

Comments

@s-aga-r
Copy link

s-aga-r commented Nov 26, 2024

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.
@akhilnarang akhilnarang transferred this issue from frappe/frappe Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant