Support » Everything else WordPress » Trying to understand the “ping” process

  • xwing

    (@xwing)


    Hi,

    A quick question – does anyone know if I import a RSS feed (5 items) as ‘posts’ into wordpress – will WP send out 5 pings? Or just 1 ping?

    All the post (via the import) has the same timestamp.

    Thanks!
    xw

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    That depends on what exactly you are talking about.

    Making or importing a post does not cause any “pings” to be sent in any way. Those are processed later, the next time wp-cron executes (which will be on the next hit to the page).

    So, in that sense, only one ping will be sent out to the update services, because it won’t have a chance to hit them repeatedly. It’ll only run once, processing all five posts.

    This is unless you’re talking about pingbacks, of course, which will be processed for the links in all 5 of the posts.

    So, you need to be more specific in your question for me to give you a more specific answer.

    Thread Starter xwing

    (@xwing)

    Hi Otto,

    Many thanks for replying. Now I’m even more confused 🙂

    When I make a post (via the write –> post in WP admin), it won’t ping the update service?

    The ping will only be sent after someone has viewed that new page/post?

    Thanks,
    xw

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    No, it will get sent the time your page gets loaded. That means any page on your site, not just that specific page/post.

    t3ch33

    (@t3ch33)

    Otto42, when you say “the next hit to the page,” are you saying that if I make a new post at 12pm and someone finally visits that new post at 12:25pm, that’s when the ping will be sent-at 12:25pm?

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    No. Look, this is very simple.

    You have a site, call it “example.com”.
    You make a post.
    Somebody, even you, looks at example.com.
    This triggers wp-cron to run and the ping is sent.

    Very, very, easy. It doesn’t matter *what* page they look at. If your site LOADS, then it gets done. Easy. They don’t have to visit “that new post”. Somebody has to visit your site. Period. Any page on your site will do.

    Thread Starter xwing

    (@xwing)

    Hi Otto,

    Thanks, that makes it very clear.

    I suppose when a new post is made, it has some kind of ‘status flag’ set – and when the site (example.com) is viewed, the ‘wp-cron’ will check for posts with that flag set.

    If found, then it will send the “ping” ?

    Sorry for the layman way of describing … is it something like that?

    Thanks for your time Otto.

    xw

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    If you want technical details, sure, I can give those to you.

    For the specific case of “Update Services”, the path works like this:
    -Creating a new post schedules a wp-cron job named “do_pings”.
    -When wp-cron is triggered, it runs that job, which calls a “do_all_pings” function.
    -The last thing that function does is to call the “generic_ping” function.
    -That function sends pings to all the update services you have listed.

    The way wp-cron is triggered is like this: whenever the page loads, the list of jobs waiting for wp-cron is pulled from the database. It compares the current time with the time those jobs are supposed to run, and runs them if it is supposed to run them now. Scheduling a job just means adding a database entry with the job name (action hook) and the time it is supposed to run.

    wp-cron handles a lot of the delayed functionality in WordPress. Future posts, for example, cause a job to be set to run at the time the post is supposed to be published. That job publishes the post. Easy.

    In the specific case of the Update Services, a “ping” really doesn’t give them any details. It just says “hey, this blog has been updated”. It doesn’t tell them how it’s been updated.

    Thread Starter xwing

    (@xwing)

    Hi Otto,

    Thank you so much! It’s getting clearer and clearer.

    Just so that I get all this down pat, is this ‘fictitious’
    scenario correct?

    ————————————–
    Assuming I made 2 post, one at 9:50pm and another at 9:57pm
    BUT nobody (not even myself) browse the site or reload the page.

    Then, at 10:02pm, somebody visited the blog, and thus trigged the wp-cron.

    The wp-cron will then “publish” those 2 post immediately, and send out only ONE ping to tell those update services that this blog has been updated.
    ————————————–

    Correct?

    Many, many thanks!

    xw

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    In that particular case, I’m pretty sure that it would send two pings, one after each post. I think that loading the wp-admin screens will trigger wp-cron to run as well. So if you made two posts manually, you’d have to come back to the admin screens at some point, which would cause it to send one ping at 9:50 and another one for the later post.

    But when importing a bunch of posts at once using an import tool, you don’t visit any screens in the interim.

    Even if it sends out two pings, it’s not a big deal because the default update service (the ping-o-matic) would not send out its own updates too often. You ping it, it pings a dozen other systems. If you ping it too fast, it knows and does not ping those other systems too fast.

    Question: Why does it matter, anyway? This is not something a user of the blog needs to know or indeed cares about. All the user needs to know is that the Update Services will be pinged on new posts. The mechanics of it are all behind the scenes and hidden.

    Thanks to all for this thema – I am looking for somethings about this, and I will use this information on my site .Special thanks for Otto42.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Trying to understand the “ping” process’ is closed to new replies.