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

fix: Fix subscriptions sending twice #21581

Merged
merged 14 commits into from
Apr 18, 2024
Merged

fix: Fix subscriptions sending twice #21581

merged 14 commits into from
Apr 18, 2024

Conversation

webjunkie
Copy link
Contributor

@webjunkie webjunkie commented Apr 16, 2024

Problem

Daily subscriptions are sent twice.

Theory: Since they run 5 minutes before the full hour, next delivery date will be scheduled again on same day (one hour later). Only then the now is larger then the intended date and next run will be scheduled correctly in a day.

Follow up from #21419

Changes

Revert #21419 but add max() so that we never take a date in the past.

Does this work well for both Cloud and self-hosted?

it doesn't have an impact

How did you test this code?

  • Cover both this case and the original case in tests.

Comment on lines +133 to +134
if "update_fields" in kwargs:
kwargs["update_fields"].append("next_delivery_date")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now recommended to add in Django 4.2, so doing it here while on it.

https://docs.djangoproject.com/en/4.2/releases/4.2/#setting-update-fields-in-model-save-may-now-be-required

@webjunkie webjunkie requested a review from timgl April 16, 2024 14:47
@webjunkie webjunkie requested a review from a team April 17, 2024 07:57
@webjunkie webjunkie enabled auto-merge (squash) April 17, 2024 11:22
@mariusandra
Copy link
Collaborator

Seems like there's a legit test failure:

image

@webjunkie
Copy link
Contributor Author

Yes, saw it after all 😅
Buried after some other stuff... which I thought is CI trouble.

@neilkakkar
Copy link
Collaborator

yeah a fix for this CI spew is here: #21613 - getting there

@webjunkie webjunkie merged commit 475fee5 into master Apr 18, 2024
97 of 98 checks passed
@webjunkie webjunkie deleted the fix/subscriptions-twice branch April 18, 2024 17:38
Copy link

sentry-io bot commented Apr 22, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ OperationalError: the connection is closed ee.tasks.subscriptions.deliver_subscription_report View Issue

Did you find this useful? React with a 👍 or 👎

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.

3 participants