Throttler Plugin

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Throttler Plugin

Post by alex.barylski »

The mroe I read up on your little library, the more I appreciate your efforts. :)

I originally was going implement the throttling code but maybe this plugin will suffice...

Basically I have a CGI script which is run every 5 minutes. This script runs a query to select *all* subscribers who should receive an email and begins iterating the array (potentially huge 100K+) calling on Swift to deliver the good news. :P

I have read several times that SMTP servers do not always respond well to constant bombardment, so throttling is typically implemented...

How does Swift implement this? Does it use sleep()?

I would like to limit the number of emails per minute to whatever my SMTP hosting service suggests (60 a minute, 1000 a minute, whatever). It would be pretty groovy if I could just delegate this handling to Swift. As opposed to calling the sleep() manually.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Throttler Plugin

Post by Chris Corbyn »

Swift just uses sleep yes. Everytime a message is sent it calculates the average rate. If the average rate is higher than you specified, it sleep()'s for enough time to compensate.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Throttler Plugin

Post by alex.barylski »

Cool. :)

p.s-Whats with the head phones in the photo? Take a ride in a air plane? Are you training a recreational/private pilots license?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Throttler Plugin

Post by John Cartwright »

Hockey wrote:Cool. :)

p.s-Whats with the head phones in the photo? Take a ride in a air plane? Are you training a recreational/private pilots license?
I believe Chris got pilot lessons as a present, but I'll let him tell you about it :)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Throttler Plugin

Post by Chris Corbyn »

Jcart wrote:
Hockey wrote:Cool. :)

p.s-Whats with the head phones in the photo? Take a ride in a air plane? Are you training a recreational/private pilots license?
I believe Chris got pilot lessons as a present, but I'll let him tell you about it :)
Nah, my friend's a pilot and he took a bunch of us up in a 6-seater over xmas.

http://w3style.co.uk/~d11wtq/flight.mp4
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Throttler Plugin

Post by John Cartwright »

Chris Corbyn wrote:
Jcart wrote:
Hockey wrote:Cool. :)

p.s-Whats with the head phones in the photo? Take a ride in a air plane? Are you training a recreational/private pilots license?
I believe Chris got pilot lessons as a present, but I'll let him tell you about it :)
Nah, my friend's a pilot and he took a bunch of us up in a 6-seater over xmas.

http://w3style.co.uk/~d11wtq/flight.mp4
Close enough :D Good stuff!
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Throttler Plugin

Post by alex.barylski »

Wicked...

Thats something I would like to do some day soon...always wanted to be a pilot... :)
Post Reply