[pmwiki-users] Newsletter throttling

Patrick R. Michaud pmichaud at pobox.com
Mon Oct 30 12:03:25 CST 2006


On Sun, Oct 29, 2006 at 07:49:21PM -0400, The Editor wrote:
> On 10/29/06, Crisses <crisses at kinhost.org> wrote:
> >> On Oct 29, 2006, at 11:31 AM, The Editor wrote:
> >>
> >> Next, set cron (I don't really know anything about this, but I think
> >> you can use it to run a php script on a schedule?). Cron calls a
> >> separate php function that checks for any text files in the queue with
> >> a name less than 60 minutes old, retrieves the corresponding message,
> >> and mails it out. Then, it deletes that list and quits the function.
> >
> > PmWiki doesn't require linux or crontab access to run.  It runs sidetasks
> > like sending out email announcements on the side when people hit a page on
> > the site.
> >
> > I suggest you look at NotifyPosts, and hook your email sending scripts to
> > take advantage of the same mechanisms PmWiki already uses.
> 
> I've begun nosing around but not sure I understand how PmWiki triggers
> it.  I could perhaps link it to a login script, or any zap function
> for that matter.  But what would happen say if no one logged in for
> several hours?  [...]  It might also mean my newsletter might
> take days to get out if the traffic were slow.  

PmWiki doesn't trigger events based on logins, it triggers them
based on any access to any page the site.

Given the existence of many highly aggressive web spiders, the idea
that a (public) site could go for hours without receiving a single hit
seems pretty remote to me.  None of the sites that I run can go for
more than a minute or two without getting a hit.  But I'll grant that 
an intranet site might not have such luck... but in this case one
could simply use cron(1) to trigger a request.

> [...]  But would that slow down the
> site?  Would the page halt the loading until all 100 emails were sent?
> That could be slow.  Or would it work independently.  I guess I don't
> understand this process very well.

Sending out 100 emails could take some amount of time, especially
if the SMTP server isn't local.  But the best thing to do is to
tell PmWiki to do any background work only *after* it's completed
the request (e.g., via register_shutdown_function).  This is what
the notify.php script does for sending out its email messages.

Pm




More information about the pmwiki-users mailing list