• Resolved jtruta

    (@jtruta)


    Hello I would like some help with a problem occurring in my Woocommerce. I have an integration between Woocommerce and a CRM (bling.com.br).

    >> In the WordPress Panel under “Woocommerce > Settings > Advanced > Webhooks” I have 4 webhooks created, being:

    1) Webhook – Order Created (ID11) – Used to create an order

    2) Webhook – Updated Order (ID12) – Used to update an order

    3) Webhook – Created Product (ID7) – Used to create a product

    4) Webhook – Updated Product (ID8) – Used to update a product

    >> The expected actions are:

    1) Webhook – Order Created – When a customer creates an order in Woocommerce, it must be created in the CRM automatically;

    2) Webhook – Updated Order – When the order status is updated, it must be updated in the CRM automatically;

    3) Webhook – Created Product – When a product is created in Woocommerce, it must be created in the CRM automatically;

    4) Webhook – Updated Product – When you update product stock, it must be created in the CRM automatically;

    >> It turns out that I have noticed that it is unstable:

    1) Webhook – Order Created – Sometimes it creates and sometimes does not create the order in the CRM.

    2) Webhook – Updated Order – Sometimes it updates and sometimes it doesn’t update the order in the CRM.

    3) Webhook – Created Product – Sometimes it creates and sometimes does not create the product in the CRM.

    4) Webhook – Updated Product – Sometimes it updates and sometimes it doesn’t update the product in the CRM.

    I accessed the WordPress Dashboard in “Woocommerce > Settings > Advanced > Scheduled Actions” and I have noticed that whenever an order or product is not created or updated in the CRM, a message is generated in Woocommerce: “Maximum simultaneous batches already in progress ( 1 row). No actions will be processed until the current batches are completed.”

    Example: After creating Order 6302 in Woocommerce we have the message: “Maximum simultaneous batches already in progress (1 queue). No action will be processed until the current batches are completed.”

    After a period of time they appear as “unsuccessful”, with the following message: ” action marked as failed after 300 seconds. Unknown error occurred. Check server, PHP and database error logs to diagnose cause.”

    In “Woocommerce > Settings > Advanced > Logs > webhooks-delivery-YYYY-MM-DD” it only shows logs that were completed successfully, but logs with errors are not shown.

    Does anyone have an idea what the problem could be? I believe Woocommerce is getting lost in “”Maximum simultaneous batches already in progress (1 queue). No action will be processed until current batches are completed.” Thank you for your help.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @jtruta

    Maximum simultaneous batches already in progress (1 queue). No action will be processed until current batches are completed.

    This is generated by Action Scheduler. Action Scheduler is designed to run only one set of scheduled actions at a time, to prevent background processes from pulling too many resources from the server at once. This prevents background updates from slowing your site down.

    If you want to increase it, you may use the Action Scheduler High Volume plugin or the guide shared here: https://github.com/woocommerce/action-scheduler/issues/847#issuecomment-1724718881

    I hope this helps! Please let us know how it goes or if you need further assistance.

    Thread Starter jtruta

    (@jtruta)

    Hi @shameemreza thanks for your help.

    Thanks for the information that “Action Scheduler is designed to execute only one set of scheduled actions at a time.” I have a question: How many set of scheduled actions are supported by Action Scheduler? I ask this because I only have 4 hooks hanging and the site is not in production at the moment. Are it only these 4 hooks with the “Pending” state that generate this message (> Maximum simultaneous batches already in progress (1 queue)…) when I create an order in Woocommerce?

    This image has an empty alt attribute; its file name is test-order-6232-4.png

    New Test: I placed a new “order 6305” for testing and then the message appeared: “> Maximum simultaneous batches already in progress (1 queue)…”. Please note that I only have 6 pending processes in the Scheduled Actions. The “order 6305” generated only 2 new processes:

    This image has an empty alt attribute; its file name is test-order-6232-5.png

    After a few minutes, Scheduled Actions shows “Order 6305” with the status “Unsuccessful”:

    This image has an empty alt attribute; its file name is test-order-6232-8-create-order.png
    This image has an empty alt attribute; its file name is test-order-6232-9-update-order.png
    This image has an empty alt attribute; its file name is test-order-6232-10-update-product.png

    I believe the set of scheduled actions supported by Action Scheduler on my site is very low. I really need to increase it, using the Action Scheduler High Volume plugin?

    Thanks for your help

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @jtruta

    I believe the set of scheduled actions supported by Action Scheduler on my site is very low. I really need to increase it, using the Action Scheduler High Volume plugin?

    Yes, you can use the Action Scheduler High Volume plugin or the code snippet shared here: https://github.com/woocommerce/action-scheduler/issues/847#issuecomment-1724718881

    Let us know how that goes. Looking forward to helping you.

    Thread Starter jtruta

    (@jtruta)

    Hi @shameemreza

    I followed the procedure (https://github.com/woocommerce/action-scheduler/issues/847#issuecomment-1724718881) and added the line of code below in the “functions.php” of my theme and the child theme:

    "add_filter( 'action_scheduler_queue_runner_concurrent_batches', function () { return 5; } );"

    I did some tests and it worked well sometimes ?? but not others ?? . The times it didn’t work I saw that “Scheduled Actions” showed the following message:

    "The next queue will begin processing in approximately SS seconds."

    It stayed in a loop for a few minutes and then “Squeduled Actions” classified it as “Unsuccessful“.

    I even thought about installing the plugin but I saw that this plugin doesn’t have a web interface and only works by command. I don’t have in-depth knowledge and I believe I will have a lot of difficulty using it.

    Do you have any other ideas?

    Thanks for your help.

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @jtruta,

    Could you try the code snippets here to increase the time limit, batch size and concurrent batches, please? Those are from Action Scheduler itself.

    Please let us know if this helps you!

    Thanks!
    -OP

    Thread Starter jtruta

    (@jtruta)

    Hi @omarfpg

    Ok, I’m doing some tests here with lines of code from the website https://actionscheduler.org/perf/

    For example, I added the code below to my child theme’s “functions.php” file:

    add_filter( 'action_scheduler_queue_runner_concurrent_batches', function () {
        return 2;
    } );
    function eg_increase_action_scheduler_batch_size( $batch_size ) {
    	return 100;
    }
    add_filter( 'action_scheduler_queue_runner_batch_size', 'eg_increase_action_scheduler_batch_size' );
    function eg_increase_action_scheduler_concurrent_batches( $concurrent_batches ) {
    	return 10;
    }
    add_filter( 'action_scheduler_queue_runner_concurrent_batches', 'eg_increase_action_scheduler_concurrent_batches' );

    So I placed an “order 6334” to test. I noticed that “order 6334″ remained in the “In Process” status for a few minutes:

    I then placed another “order 6335“. This “order 6335” was processed quickly and was ahead of “order 6334″ which remained in the “In Process” status:

    Order 6335” was executed successfully and quickly ?? , but “order 6334 had the status “unsuccessful” ?? :

    I don’t understand the logic and the instability. “Order 6335”, made after “Order 6334”, was processed successfully, but “Order 6334” was not. ??

    If you have any tips let me know.

    Thaks for your help.

    • This reply was modified 6 months, 1 week ago by jtruta.
    • This reply was modified 6 months, 1 week ago by jtruta.
    Thread Starter jtruta

    (@jtruta)

    Hi @omarfpg

    I did more tests and noticed the following behavior:

    1. Orders are executed successfully only when there is a previous order (woocommerce_deliver_webhook_async) being executed with the status In Process” When I place an order and there are no previous orders with the status “In Process” in “Scheduled Actions“, the order is classified as “Unsuccessful” after a while.

    In the image below, I placed “order 6347” which had the status “in process” because it was the first order. After a while this “order 6347” will have the status “Unsuccessful“:

    But during this period as long as the status of “Order 6347” remains “in process“, all new orders will be processed successfully. See the image below for “Order 6348“, which was executed successfully and very quickly by “Scheduled Actions“, because there is an “Order 6347” with the status “In Process“:

    It’s as if “Scheduled Actions” was sleeping. Upon receiving the first order, “Scheduled Actions” wakes up, but is unable to execute it, leaving this order in the “In process” state. During this period when an order is in the “In Process” status, it is as if “Scheduled Actions” was awake and ready to process all subsequent orders that arrive, executing these new orders quickly and successfully.

    Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @jtruta

    The behavior you’re observing seems related to the Action Scheduler’s queue runner and its management of concurrent batches and batch sizes. The code snippet you’ve used should increase the action scheduler’s batch size and the number of concurrent batches it can handle, but there may be some unintended consequences.

    The order of execution and the “In Process” status of orders seems to be affected by these changes. When an order is first placed, it seems the Action Scheduler is taking some time to “wake up” and process it, hence the “In Process” status. Subsequent orders, however, are processed more quickly, likely because the Action Scheduler is already “awake” and able to handle more tasks concurrently due to the increased batch size and number of concurrent batches.

    One possible solution is to adjust the batch size and number of concurrent batches to better match your server’s capabilities. Too high a number might overwhelm your server, causing the initial delay in processing orders.

    You might also want to consider using the action_scheduler_failed_action hook to log failed actions and investigate why they fail. This might provide more insight into why the first order remains “In Process” for an extended period of time.

    Also, check whether your site cron has any issues or not using the WP Crontrol or Advanced Cron Manager plugin.

    Additionally, I would suggest creating a report in our GitHub repo so that our developer can check it and provide further insights. You can also ask on the #developers channel of the WooCommerce Community Slack. Many of our developers hang out there and will be able to offer insights into your question.

    I wish I could help more, but hopefully, this gets you going in the right direction to get the job done.

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi there ?? ,

    We haven’t heard from you in a while; this is to check if you’ve been able to proceed with the troubleshooting steps provided before and if you still need help.

    Thanks!
    -OP

    Thread Starter jtruta

    (@jtruta)

    Hi @omarfpg

    The problem still persists. I’m doing some testing and opening a ticket at GitHub repo. I’ll let you know as soon as I get something.

    Thanks for your help.

    Plugin Support Zubair Zahid (woo-hc)

    (@doublezed2)

    Hello jtruta

    Thank you for you reply.

    Opening a ticket at the GitHub repo is a good step.
    Please share your findings with us here as it will be helpful for fellow Woo community members.

    Have a great day!

    Thread Starter jtruta

    (@jtruta)

    Hello @doublezed2 @omarfpg @shameemreza, just to update and close this ticket.

    I noticed that the problem was in the “WordPress 2-step verification” plugin https://br.www.ads-software.com/plugins/wordpress-2-step-verification/ . For some reason, it caused the Webhook task to generate an “unsuccessful” state. After uninstalling this plugin, the Webhook started to work.

    Then, I noticed that although the webhook worked correctly, the order status update took a long time to occur in the ERP, around 48 minutes, so I did some more tests. I changed PHP to version 7.4, previously it was on 8.0 and I noticed that the ERP update now took up to 2 minutes. Maybe it’s because the ERP Webhook configured in Woocommerce uses the “WP REST API v2” version and probably works better with PHP 7.4. I don’t know for sure, but this configuration worked better.

    Thank you to everyone here for your support.

    Have a great day!

    Hey, @jtruta!

    Thank you for sharing the solution here and contributing to the WooCommerce Community. This might help other users in the future. ??

    Please let us know if there’s anything else we can do to help or if you have any questions.

    Have a wonderful day!

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.