fixthestatusquo / proca-server

Proca server, SDKs and services
https://proca.app
4 stars 3 forks source link

put failsafe limits on MTT #232

Open tttp opened 6 months ago

tttp commented 6 months ago

Currently, if you by mistake change the end date to a date close to now and there are still emails to sent, it will try to push them all, risking a flood and blacklisting

When checking for emails to send , add a limit to no more than PROCA_MAX_HOURLY_EMAIL (environment variable, adjust the name to make it more proca way of doing things if needed) defaults to 99 emails per hour. and no less than 1,

so if the campaign setting is set to send from 1st of april to the 30 of april from 9am to 17h (30 daysx10 hours):

the aim of the later is to prevent spamming the target "too much" if there is a mistake on the setting or when we change the end date/hour.

v2/unless trivial: Put another limit of how many emails per target can be sent in total (global default, can be overwritten by campaign), max 10k

@hiemanshu while you look at the current code, can you confirm it does properly spread sending the emails over the sending period queried (one hour) vs sending all the batch at the start of the hour?

tttp commented 4 months ago

to put more context: in the future, we would want to adjust the way the emails are spread over the day: right now it has a start and end date, if the future, we probably wants something smarter, for instance avoiding going from 0 a start -1hour to the same flat max during "sending hours" dropping to 0 at end + 1 hour.

tttp commented 3 weeks ago

@destag ,

I'm wondering if we aren't taking this in the wrong order.

we have a delivery that tries to avoid flooding the recipients by spreading the sending over time until the end of the period, but we have to plan that failsafe because we might still have case where we have too many emails to spread over too little time

I'm wondering if a better approach is not to limit how many email each recipient can receive over the next cycle (say 10 min)

that way we can adjust based on each campaign strategy, and have a max email per cycle that is close to how the actions are distributed over time (so 0 between 1am and 6am, 10 email/h between 11 and 1am and 6am and 8am with a max of 60 email/hour at 10-12 and 14-18h (we can use the data we have)

@destag @1v4n4 to be discussed ;)

1v4n4 commented 3 weeks ago

0 between 1am and 6am, 10 email/h between 11 and 1am and 6am and 8am with a max of 60 email/hour at 10-12 and 14-18h More questions: