WordPress.org

Ready to get started?Download WordPress

Forums

Trying to understand the "ping" process (11 posts)

  1. xwing
    Member
    Posted 6 years ago #

    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

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  3. xwing
    Member
    Posted 6 years ago #

    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

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

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

  5. t3ch33
    Member
    Posted 6 years ago #

    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?

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  7. xwing
    Member
    Posted 6 years ago #

    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

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  9. xwing
    Member
    Posted 6 years ago #

    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

  10. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  11. stube
    Member
    Posted 6 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.