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

Handle campaigns with a large number of emails #64

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

killion
Copy link
Contributor

@killion killion commented Aug 21, 2024

I ran into the Prisma limit with more than 32,767 contacts in a campaign. I saw this chunk method had been used in other parts of this controller so I reused it.

const chunkSize = 500; gets set 3 times now. Maybe it can be an env var?

I'm also thinking the 80 sends per batch could be an env var too. I'll try to make that a PR.

@driaug
Copy link
Member

driaug commented Aug 27, 2024

Will be verifying these changes later today but looks promising!

@killion killion changed the title Chunk prisma.campaign.update the same way as other calls Handle campaigns with a large number of emails Aug 27, 2024
Running update on a large campaign will time out. There is a separate update option already.

Linting also changed the file a lot.
@killion
Copy link
Contributor Author

killion commented Aug 27, 2024

Thanks, I added a few things to handle large campaigns besides chunking so I renamed the PR.

When I set the RATE_LIMIT to something higher I would often run into a race condition that resulted in the same email being sent more than once. So now there is a lock in Redis.

I worry that the 15 minutes isn't long enough if a lot of emails are going at once.
@driaug
Copy link
Member

driaug commented Aug 30, 2024

Hey, is this PR ready for review?

@killion
Copy link
Contributor Author

killion commented Aug 30, 2024

Hey, is this PR ready for review?

I think so, I left some logging in there because it is only a few lines and I found it to be generally helpful.

@driaug
Copy link
Member

driaug commented Sep 13, 2024

Looks great, could you set the version in the main package.json to 1.0.7

Once that is done, it is ready to be merged in!

@dentroai
Copy link

just seen that this PR is stale, but it seems quite useful.
Just wanted to ping to see if it's to be abandoned or merged.

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