Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @rayanarts,

    Thank you for this information – I am looking over the snippet and it appears that snippet is slightly different from the default snippet that has been shared previous:

    add_filter( 'action_scheduler_retention_period', function() { return DAY_IN_SECONDS * 1; } );

    It is possible that filter was custom to that particular site, so the filter may need to be customized a bit to work with your own site. The overall filter (explanation, how to adjust, etc) is at this link.

    You can also temporarily install the Action Scheduler – Disable Default Queue Runner plugin as a test, and instructions for it are here. This can see if there are errant items in it.

    Also, if you go to the WooCommerce > Status > Logs area, are there any fatal logs pertaining to the Action Scheduler? If there are please post them in a reply.

    Thread Starter rayan.arts

    (@rayanarts)

    Hi @nixiack8 ,
    Thank you for your help…
    I am going through your giving feedback above.

    Here is the latest Log error:

    fatal-errors-2021-10-17-58fdcb86947ac59ac468a1374ea995c5.log

    2021-10-17T15:14:05+00:00 CRITICAL Uncaught Error: Call to a member function format() on null in /var/www/vhosts/impartial.one/httpdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_wcSystemStatus.php:79
    Stack trace:
    #0 /var/www/vhosts/impartial.one/httpdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_wcSystemStatus.php(52): ActionScheduler_wcSystemStatus->get_action_status_date()
    #1 /var/www/vhosts/impartial.one/httpdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_wcSystemStatus.php(27): ActionScheduler_wcSystemStatus->get_oldest_and_newest()
    #2 /var/www/vhosts/impartial.one/httpdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_AdminView.php(50): ActionScheduler_wcSystemStatus->render()
    #3 /var/www/vhosts/impartial.one/httpdocs/wp-includes/class-wp-hook.php(303): ActionScheduler_AdminView->system_status_report()
    #4 /var/www/vhosts/impartial.one/httpdocs/wp-includes/class-wp-hook.php(327): WP_Hook->ap in /var/www/vhosts/impartial.one/httpdocs/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_wcSystemStatus.php on line 79

    2021-10-17T18:10:31+00:00 CRITICAL Allowed memory size of 134217728 bytes exhausted (tried to allocate 10489856 bytes) in /var/www/vhosts/impartial.one/httpdocs/wp-includes/functions.php on line 4133

    Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hey @rayanarts,

    Carrying out some testing for you today I used this code snippet on my test installation to purge the action scheduler data based on the time frame of one week.

    add_filter( 'action_scheduler_retention_period', 'wc_action_scheduler_purge' );
    /**
     * Change Action Scheduler default purge to 1 week
     */
    function wc_action_scheduler_purge() {
     return WEEK_IN_SECONDS;
    }

    Screenshot of before code was added

    You’ll see before the code snippet was added that there were 4568 tasks.

    Image Link: https://cloudup.com/cbRuTByBgrw

    Screenshot from after the code was added

    After the code was added and after waiting you’ll notice that the tasks are being reduced over time.

    Image Link: https://cloudup.com/cMo0ZGLEdYQ

    Note: It does take some time for this process to run and you will see slight incremental decreases in the tasks when refreshing the page until it completes.

    I did notice this error message in your log.

    2021-10-17T18:10:31+00:00 CRITICAL Allowed memory size of 134217728 bytes exhausted

    That relates to your server running out of memory and it could in theory affect the deletion of scheduled actions using the code snippet I tested above for us.

    Thread Starter rayan.arts

    (@rayanarts)

    Hi @stuartduff ,

    Thank you for your help, I will follow your input today. will update my experience here.

    Hi @rayanarts,

    It’s been a while since we heard from you, so I’m marking this thread resolved. Hopefully, you’ve been able to resolve this, but if you haven’t, please open up a new topic and we’ll be happy to help out.

    Cheers

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Actionscheduler_logs bloating’ is closed to new replies.