#6108 (send_pending_emails_often runs only once a day)
by Luc Saffre · in Developers · assigned to Luc Saffre
Kurzbeschreibung
Kinder
Kommentare
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : Uff! Probably done! (but not yet committed). I added a section "Demo dates and the timezone" in book/docs/projects/polly.rst
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : I'm quite sure now that it's a timezone problem but didn't yet manage to prove this.
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : Maybe it has nothing to do with async, maybe it's a timezone problem.
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : One possible approach is to stop using Site.now() because it is not async-safe. But a better approach would be to make it async-safe.
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : I'm wondering whether this might also be the explanation for #6101 (creation time of comment in jane is in the future).
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : Yes, and right now it allegedly ended at 2025-05-17T23:59:57, i.e. 24 hours into the future. And I have an email "13 [jane] notifications" in my inbox, dated 2025-05-16T00:00:04
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : It seems that the bug is in the core.Site.now() method, which is defined as follows:
def now(self, *args, **kwargs): t = self.today() now = timezone.now() return now.replace(year=t.year, month=t.month, day=t.day)
And today() potentially makes a database lookup, which can... - 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) : Created new Ticket #6108 (send_pending_emails_often runs only once a day).
- 1 Jahr, 5 Monate ago von Luc Saffre about #6108 (send_pending_emails_often runs only once a day) (1 Antwort) : Aha, here is a new observation regarding why we are getting our email notifications only once per day. The System task send_pending_emails_often currently has a status of "Scheduled to run at 17.05.2025 00:00 (8 hours from now)", The last run was yesterday 10 seconds before midnight: Started at: 202...