Re: Event Handling
| From: | Paul M Foster | Date: | Mon, 15 Mar 2010 18:12:18 +0000 |
| Subject: | Re: Event Handling | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-302859@lists.php.net to get a copy of this message | ||
On Mon, Mar 15, 2010 at 05:38:04PM -0000, Alex Major wrote:
> Thanks to all for your help on this, it's been very interesting for me to
> read.
>
> The system needs to check arrivals in real time (give or take a second or
> two), using a cron job every minute doesn't provide the real time checking I
> would like.
>
> However, when I then got to thinking about it, wouldn't this be an ideal
> solution? I create a PHP script that loops for 60 seconds, checking the
> database each second for new entries and processing them (meaning I get near
> real time monitoring), and then have that PHP script called by a cron job
> every minute.
>
> The reason I think that could be a good solution for me, is that if the PHP
> script crashed (for any reason), then at most it's 59 seconds before the
> system kicks in again and begins processing all the queued arrivals. If I
> coded a PHP script to loop infinitely processing things every second, it's
> possible I wouldn't notice a crash for a considerable amount of time. The
> proposed solution provides a good fail-safe, I think.
>
> Does that solution seem sensible? Or overkill?
>
> Thanks again for your help in this, it's quite novel for me.
I would think that the PHP CLI extension would need to be installed on
the server for this to work. I don't know that that's common. (I could
be completely wrong.)
I would recommend coding this in C, because it would use far less
resources.
Paul
--
Paul M. Foster