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

refactor: do batched requests for braze tracking in lic assignment #569

Merged
merged 1 commit into from
Jan 25, 2024

Conversation

iloveagent57
Copy link
Contributor

@iloveagent57 iloveagent57 commented Jan 24, 2024

Description

Currently, each call to track license lifecycle state (e.g. during license assignment) seems to make 2 calls to braze per license:

  1. Call to create_braze_alias.
  2. Call to track_user.

This is an attempt to utilize the braze API more efficiently. If we don’t, we’re going to end up making around 1 million calls to braze during the execution of a script that assigns 400,000 emails. The risk here is that we get rate-limited, or just see "normal" failed requests to braze, and many users/licenses end up in a partially tracked state that leads to difficulties/support-overhead during license activation.

Another subtle change here: as part of assignment, we conditionally want to send assignment notification emails. These require that we have braze aliases setup. I've re-ordered the chain of tasks we kick off to only explicitly create braze aliases in a task IF we're going to send those notifications.
Note that the task to track license changes also creates braze aliases during assignment (so we can track users who don't have an lms_user_id yet). It's fine to do the alias tracking call multiple times (its idempotent on the Braze side), especially now that we're doing all alias creation as batched work. But with this second change, we now will only create aliases at one point (during lifecycle tracking) when assignment notification is disabled.

Link to the associated ticket: https://openedx.atlassian.net/browse/ENT-8304

Testing considerations

  • Ran a manual test in the braze dev account, results captured in ticket.

Post-review

Squash commits into discrete sets of changes

@iloveagent57 iloveagent57 force-pushed the aed/assignment-tracking-refactor branch 2 times, most recently from 79282cf to 06ff86c Compare January 24, 2024 21:57
@iloveagent57 iloveagent57 marked this pull request as ready for review January 24, 2024 22:15
Copy link
Contributor

@pwnage101 pwnage101 left a comment

Choose a reason for hiding this comment

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

The rest LGTM, just curious about not sending segment events anymore!

@iloveagent57 iloveagent57 force-pushed the aed/assignment-tracking-refactor branch from 06ff86c to 01bde17 Compare January 25, 2024 15:38
@iloveagent57 iloveagent57 force-pushed the aed/assignment-tracking-refactor branch from 01bde17 to db0a61d Compare January 25, 2024 17:34
@iloveagent57 iloveagent57 merged commit 4e66d3e into master Jan 25, 2024
7 checks passed
@iloveagent57 iloveagent57 deleted the aed/assignment-tracking-refactor branch January 25, 2024 19:06
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