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

refactory: Whatsapp Notification scheduler events must be setted on hook.py #112

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

HarryPaulo
Copy link
Contributor

Problem: Every time you run migrate, the events inserted in the Scheduled Job Type doctype are deleted.

Reference frappe code:
https://github.com/frappe/frappe/blob/59309f8164f6a360017004324495f456844a49ce/frappe/migrate.py#L141

Frappe limitation:
Currently, the Frappe structure only allows you to create dynamic events for server scripts...

All other events must be in the application's hooks.py, otherwise they will be deleted on run migrate

@HarryPaulo
Copy link
Contributor Author

A second alternative would be to use the hooks.py event "after_migrate" inserting the events accordingly...

However, the downside of this is that every time you run migrate, frappe will delete the frappe_whatsapp records from the "Scheduled Job Type"

And after migrate ("after_migrate") we would insert a new record in the "Scheduled Job Type".

The downside is the workload when running migrate and the loss of the event execution history.

So this led me to choose to use the system's native trigger "scheduler_events"

@shridarpatil shridarpatil merged commit 1da86f9 into shridarpatil:master Jan 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants