From 0af6828ca65805ef80e8521ced0ade7efbef6b5b Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 14 Aug 2024 15:54:04 -0400 Subject: [PATCH] add filter for action scheduler retention period --- includes/Performance.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/Performance.php b/includes/Performance.php index 5dffad6..af1ec3d 100644 --- a/includes/Performance.php +++ b/includes/Performance.php @@ -130,9 +130,18 @@ function () { ); add_action( 'after_mod_rewrite_rules', [ $this, 'onRewrite' ] ); - + add_filter( 'action_scheduler_retention_period', array( $this, 'nfd_asr_default' ) ); } + /** + * Update the default action scheduler retention period to 5 days instead of 30. + * The actions scheduler table tends to grow to gigantic sizes and this should help. + * + * @return int new retention period + */ + function nfd_asr_default() { + return 5 * DAY_IN_SECONDS; + } /** * When updating mod rewrite rules, also update our rewrites as appropriate. */