[wp-hackers] When a ping is sent ?
skeltoac at gmail.com
Mon Dec 19 18:49:06 GMT 2005
On 12/19/05, Joseph Scott <joseph at randomnetworks.com> wrote:
> I'm looking at spawn_pinger() (version 3321 of wp-includes/
> functions.php) and I don't see how a simple call to fsockopen() are
> enough to create a new thread. I couldn't find anything at php.net/
> fsockopen about creating a new thread. I don't think that PHP
> currently has any way to spawn new threads. Are you confusing fork
> with thread?
My description is probably not technically accurate--the word
"semaphore" clouds my vision--but the script in execute-pings.php
continues to run after the user's request has been fully handled.
Calling it a thread or a fork may be inaccurate.
The fsockopen call specifies a timeout of 0.01 seconds. Therefore the
user's request is never significantly impacted by the pinging script.
It just says, "GO!" and then forgets about it.
There was supposed to be a call to ignore_user_abort() in
execute-pings.php but it seems I forgot it.
Anyway, I tested thoroughly and found that when I publish, the next
admin screen loads rapidly and I can continue working. I watched the
access_log as the pings were received at the other server over the
next minute. It works.
The other complaint I have seen recently is from users who have
inserted many urls into the ping services option. This is never done
asynchronously and thus impacts the experience negatively. This should
be fixed in 2.1 using the same technique as spawn_pinger.
More information about the wp-hackers