Hi!
How are you?
Unfortunately there's no throttling built into the module at present.
It's would be a very handy feature I'd imagine, but unfortunately too much work to implement at this time. :(
All the best...
Conor
Ceon
Printable View
Hi!
How are you?
Unfortunately there's no throttling built into the module at present.
It's would be a very handy feature I'd imagine, but unfortunately too much work to implement at this time. :(
All the best...
Conor
Ceon
Could there be a simple way to add
into the loop somewhere?PHP Code:
sleep(10);
I got that from the php manual.
Hi,
Certainly you can add that, but I don't know how much difference it will make. I'd imagine it'd probably be better than nothing but unfortunately I don't know enough about throttling to know if adding a 10 second delay would be enough to prevent servers blocking e-mails for breaching their limits for e-mails sent from a particular address. I'd have to research what these limits are and how any rules are applied in order to build an effective throttling mechanism into the software. Sadly, I just don't have the time to do that.
Hopefully I will in the future as I think it would be useful to know and therefore useful to implement.
As for the sleep() function. If you were to add it you'd have to add a counter into the sendBackInStockNotifications() function in
admin\includes\functions\back_in_stock_notifications_functions.php
and have it run the sleep command after a particular number of e-mails have been sent.
All the best...
Conor
OK, just finished digging through the code in phplist and they do use sleep(x) as one of the throttling functions. They actually use three but this is described as the simplest way. The more complex ones are batch throttling (which would match what you mentioned about counting a batch then stopping) and domain throttling (which limits the number going to any one domain per period, an even more complex count).
I'm just after a simple sleep(). If I have 1000 emails going out and I sleep(10) the loop, they would all still go out overnight easily. Can you tell me a good place to add that command? I don't think I need the counter, etc. A delay between each email sent would be fine with me.
My only concern would be timeout.
Hi,
Just before line 154 of the admin/includes/functions/
($email_addresses_result->MoveNext();)
You could add the following code:
You should also add the following before the while loop on line 65:PHP Code:
$num_emails_in_batch++
if ($num_emails_in_batch > 100) {
$num_emails_in_batch = 0;
sleep(10);
}
Just good coding practice! :)PHP Code:
$num_emails_in_batch = 0;
I might make this simple functionality an option in the next version with a configurable number of e-mails in a batch and sleep time.
All the best...
Conor
Ceon
Conor,
You've been very patient with my persistent badgering about this little detail. Once again, thank you very much!
Hmm...got trouble:
Parse error: syntax error, unexpected T_IF in /home/xxxxxx/xxx/xxx/admin/includes/functions/back_in_stock_notifications_functions.php on line 158
do i need the batch counter or can I just try the sleep?
I commented out everything but the sleep(10);
I have not entered inventory except a little testing bit. There would be 43 emails sent. At 10 seconds it stalls out and goes to a blank page. At 2 seconds, same thing. At 1 second, it takes just over 43 seconds (guesstimate) to return the successful results of a test mailing. In all 3 cases, the sample email was successfully sent out.
Hi,
Oops, there's a missing semicolon after
It should be:PHP Code:
$num_emails_in_batch++
Sorry! :)PHP Code:
$num_emails_in_batch++;
Sounds like PHP is timing out.Quote:
I have not entered inventory except a little testing bit. There would be 43 emails sent. At 10 seconds it stalls out and goes to a blank page. At 2 seconds, same thing. At 1 second, it takes just over 43 seconds (guesstimate) to return the successful results of a test mailing. In all 3 cases, the sample email was successfully sent out.
You must have safe mode on, otherwise the script would set the maximum execution time/timeout for PHP to 0 ("Don't time out").
If you don't have access to your server to change the safe_mode setting or the max_execution setting then I'm afraid the sleep() command will be useless for you! :(
All the best..
Conor
Safe Mode is Off.
The notification panel pulls up just fine now.
Test run works fine. There's no delay, though, since it's only 43 emails and they batch up as one.
So, i ran the test with the batch size at 10 and the sleep at 20 seconds. Goes to blank page in just over 1 minute.
maybe it's my database connection?
I've decided to try to run it without the delay. I'll just do it after the phplist newsletter goes out and hope for the best. Looking through the list, most of the serious customers are waiting for multiple items. Also, not all of the items will be restocked at this time. It might be fine.