• Resolved Luke Cavanagh

    (@lukefiretoss)


    Form action on the admin-ajax.php request on the front-end of the site is
    mabel-rpnlite-getnew-purchased-products

    admin-ajax.php request is in the 400-500ms range, is this normal?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Maarten

    (@maartenbelmans)

    Hey Luke,

    Sorry for my late reply!

    The plugin is caching query results in a transient so this should be faster than 500ms. Of course that depends on the site. Does the site perform other admin-ajax requests? If so, are they faster?

    Thread Starter Luke Cavanagh

    (@lukefiretoss)

    @maartenbelmans

    The only front-end admin-ajax.php request being made on the site is related to WooBought.

    Plugin Author Maarten

    (@maartenbelmans)

    I’m not sure how technical I can go so I apologize if the explanation below makes no sense but I think I remember you from the Woo Facebook groups and am quite sure you’re technically better versed than I am so here is some context :-).

    We call get_posts() which fetches the 15 latest Woo orders (post type “shop_order”). Then we loop that result to fetch product & order info via the Woo API:

    $order = new WC_Order($post->ID);
    $order_items = $order->get_items();

    After the loop, the whole result set is cached for 1 minute but I will move that up to some more minutes (the real-time nature of the plugin doesn’t allow me to cache this for a long time).

    I can imagine the initial query isn’t the fastest but it should also not take 0.5s. Moreover, when cached it should be fast.

    What I can do is move away from the standard API. In that case, I don’t have to do the loop and I can use wpdb to fetch everything in one query (essentially writing my own SQL query).

    If you have some other ideas/insights, I’m all ears.

    Plugin Author Maarten

    (@maartenbelmans)

    Any updates or insight into this or can I close it?

    Thread Starter Luke Cavanagh

    (@lukefiretoss)

    @maartenbelmans

    Thank you for the earlier technical details.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Slow admin-ajax.php request is being caused by this plugin’ is closed to new replies.