• Resolved joshuabaker

    (@joshuabaker)


    My plugin sometimes posts twice rather than once. I have it setup to auto post every hour – however about 50% of the time, every hour it will actually post twice. These are not duplicate posts, they are different posts from my draft section. Please advise. Thanks

    2015-03-25 05:44:44 – draft POST id 57496 PUBLISHED : ‘Lucky man almost hit by lightning’
    2015-03-25 05:44:46 – draft POST id 57502 PUBLISHED : ‘Cat and bear’
    2015-03-25 06:44:23 – DEBUG: eligible posts WP_Query Array
    (
    [posts_per_page] => 1
    [cat] =>
    [post_type] => Array
    (
    [0] => post
    )

    [ignore_sticky_posts] => 1
    [post_status] => Array
    (
    [0] => draft
    )

    [order] => ASC
    )

    2015-03-25 06:44:23 – DEBUG: found 1 results.
    2015-03-25 06:44:23 – DEBUG: processing post Call of Duty in a nutshell
    2015-03-25 06:44:23 – DEBUG: wp_update_post Array
    (
    [ID] => 57487
    [post_status] => publish
    [post_date_gmt] => 2015-03-25 05:44:23
    [post_date] => 2015-03-25 06:44:23
    )

    2015-03-25 06:44:23 – DEBUG: eligible posts WP_Query Array
    (
    [posts_per_page] => 1
    [cat] =>
    [post_type] => Array
    (
    [0] => post
    )

    [ignore_sticky_posts] => 1
    [post_status] => Array
    (
    [0] => draft
    )

    [order] => ASC
    )

    2015-03-25 06:44:23 – DEBUG: found 1 results.
    2015-03-25 06:44:23 – DEBUG: processing post Funny soccer
    2015-03-25 06:44:23 – DEBUG: wp_update_post Array
    (
    [ID] => 57490
    [post_status] => publish
    [post_date_gmt] => 2015-03-25 05:44:23
    [post_date] => 2015-03-25 06:44:23
    )

    2015-03-25 06:44:32 – Post published outside of APS – Auto Post Scheduler restarted
    2015-03-25 06:44:32 – draft POST id 57490 PUBLISHED : ‘Funny soccer’
    2015-03-25 06:44:34 – draft POST id 57487 PUBLISHED : ‘Call of Duty in a nutshell’
    2015-03-25 06:53:12 – Options Saved! New Auto Post Schedule time will be used after next auto post check.

    https://www.ads-software.com/plugins/auto-post-scheduler/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author johnh10

    (@johnh10)

    Okay here’s what I *think* is happening: there might be a bottleneck in your mysql database slowing down values to be updated for at least a few seconds.

    1. After WordPress triggers an event, WordPress should immediately update the database with the next scheduled time. However sometimes the event is called twice before it can finish updating the database.

    2. In your log above, the call to wp_update_post happens at 06:44:23 but the next line of code to log the PUBLISHED message doesn’t happen for another 9 seconds… which implies wp_update_post took 9 seconds to write to the database.

    3. I see that wp_update_post also triggers the ‘Post published outside of APS’ message. A toggle is set in the database when APS calls wp_update_post to prevent this. It should only fail if writing to the database fails.

    Are you able to see your site’s error logs? Specifically mysql errors.

    There are 2 things to try:

    Switch from using WP-Cron to a server cron job called every 5 minutes (see FAQ).

    and/or

    Install the development version of APS I just uploaded. It contains extra checks and DEBUG messages that might tell us something.

    I occasionally used to have this same problem until I switched to server cron.

    Plugin Author johnh10

    (@johnh10)

    Haven’t heard back, assuming closed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sometimes posting twice?’ is closed to new replies.