-
Notifications
You must be signed in to change notification settings - Fork 10
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
feature/sync-with-contacts-preloaded #5818
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5818 +/- ##
==========================================
- Coverage 96.49% 96.49% -0.01%
==========================================
Files 1041 1041
Lines 24708 24724 +16
Branches 1641 1644 +3
==========================================
+ Hits 23843 23858 +15
- Misses 709 710 +1
Partials 156 156 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
be8c83c
to
a8cc563
Compare
7b739bb
to
24dda5f
Compare
baarkerlounger
approved these changes
Nov 22, 2024
oliverjwroberts
approved these changes
Nov 25, 2024
samuele-mattiuzzo
pushed a commit
that referenced
this pull request
Nov 25, 2024
* Load all contacts at start of job * PR comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of change
Using the django DB for individually checking if a contact in the S3 file existed was running slowly on production (200-300 milliseconds per query), with a file that contains 1.3 million rows.
To reduce the number of individual queries being executed against the DB, at the start of the job load all contacts from the DB into a python dictionary. This initial load of users takes around 4-5 minutes, however no further DB reads are required during the processing of the file.
This has been tested on a local environment with 600,000 contacts, and took 6-10 minutes to fully process the file with ENABLE_CONTACT_CONSENT_INGEST setting equal to
False
. Setting this value toFalse
allows testing of the file processing logic, without making any changes to the contact in the DB.When ENABLE_CONTACT_CONSENT_INGEST was set to
True
, the same 600,000 users takes 20-25 minutes to fully process the file and update the contact in the DB with the latest value for that contacts consent. As the only fields this job need to update are theconsent_data
andconsent_data_last_modified
, theupdate
django function is used instead ofsave
to avoid triggering the subscribed contact signals that submit additional sync jobs to the short queueChecklist
Has this branch been rebased on top of the current
main
branch?Explanation
The branch should not be stale or have conflicts at the time reviews are requested.
Is the CircleCI build passing?
General points
Other things to check
fixtures/test_data.yaml
is maintained when updating modelsSee docs/CONTRIBUTING.md for more guidelines.