How to set Email sending speed limit?

Hey Josh!

For digests you can limit this to 14 per second by setting this Discourse global to 420, as follows in your container build file:

 DISCOURSE_MAX_DIGESTS_ENQUEUED_PER_30_MINS_PER_SITE: 420

This is not “exactly” what you want but it is darn close.

Since 14 per second (from your post) times 30 seconds = 420, this global setting will limit digests to around 420 per every 30 minutes, just like the code “says”:

See also:

https://github.com/discourse/discourse/blob/master/app/jobs/scheduled/enqueue_digest_emails.rb#L37

Naturally, if your SMTP channel is sending other emails, you will need to adjust this down; or you can set up a different, separate channel for digest emails (like we do).

Note: This global setting is set to 10,000 per 30 minutes by default; which is a lot of digests per hour if you ask me ;). So, we set this much lower so we have a “reasonable” SendGrid bill each month.

30 digests per 30 minutes = 1440 per day, or around 43,200 per month (because we were sending a lot of digests before I made this change a few days ago). Next month, I will bump this up to around 60 digests per 30 minutes, or around 86,400 digests per month plus or minus.

Hope this helps.

3 Likes