Reply to Re: Asynchronous function call?

Your name:

Reply:


Posted by ELINTPimp on 08/13/07 12:33

On Aug 13, 3:51 am, gosha bine <stereof...@gmail.com> wrote:
> On 11.08.2007 21:41 Fabio wrote:
>
>
>
> > "ELINTPimp" <smsi...@gmail.com> ha scritto nel messaggio
> >news:1186860780.947564.220510@k79g2000hse.googlegroups.com...
>
> >> PHP, being an extreamly veristile language, can be made to do many
> >> thing with enough imagination =). First, we really need to know what
> >> you are doing, how, and why. By you using the term 'asynchronous', I
> >> assume you probably a good amount about programming and threads. So,
> >> I'm not trying to assault you're judgement, but wanting to help you in
> >> the best way.
>
> >> On way to do this is to call a/multiple CLI scripts from your base PHP
> >> script, let them process in the background, do some more things if you
> >> would like with your "base" script, and get back to them, reading the
> >> results later on (if you want).
>
> > Ok, I thank you and I'll explain.
> > In a web site page, when someone press a submit button I should exec a
> > mail() function to send an email to each registered user.
> > The execution of mail() is a little slow, so if the user list is a little
> > long who pressed the button need to wait to obtain the interaction with the
> > site.
> > My idea is to exec all the calls to mail() in background, so the interation
> > is immediate and if the mail sending use some "hidden" minutes it's not a
> > problem.
>
> > I hope I was clear wth my english and newbie php language :)
>
> > Thanks again.
>
> I think you'd be better off having a mail sender cronjob running
> independently from your web application. The application only creates a
> working set for the cronjob (e.g. populates a database table or similar).
>
> --
> gosha bine
>
> makrell ~http://www.tagarga.com/blok/makrell
> php done right ;)http://code.google.com/p/pihipi

cronjob's a good idea, especially if you don't need the mailing
executed dynamically from a web page. But it seems like he wants to
send a notification email, or something of the sort, to all the
registered users when a ticket is submitted (something like a helpdesk
system, or something of the sort). If the speed of the submission of
a email message is "time-critical" (we all know we really shouldn't
DEPEND on email on the Internet, but often times it's an important
component), perhaps a cronjob isn't really the solution. You could
set your cron to check every 5min or so, but then your delayed 5min
and there is overhead in calling the DB at least once (maybe twice to
check if there are messages pending and once to query users).

as always, it comes down to what you need for your particular
situation.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация