Add transients size check - #217
Conversation
|
Hello! 👋 Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project. Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation. Here are some useful Composer commands to get you started:
To run a single Behat test, you can use the following command: # Run all tests in a single file
composer behat features/some-feature.feature
# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123You can find a list of all available Behat steps in our handbook. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe pull request adds a ChangesTransients size check
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Transients_Size
participant WP_CLI_option_list
participant WordPress_options
Transients_Size->>WP_CLI_option_list: Request autoloaded transient sizes
WP_CLI_option_list->>WordPress_options: Query transient options
WordPress_options-->>WP_CLI_option_list: Return option sizes
WP_CLI_option_list-->>Transients_Size: Return total bytes
Transients_Size-->>Transients_Size: Compare total with threshold
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Summary
Adds a separate transients-size check for detecting large autoloaded transients.
Non-expiring transients are autoloaded by WordPress, but they are intentionally excluded from the existing autoload-options-size check. This new check reports them separately, as suggested in the issue.
The check is included in the default Doctor configuration and uses the same configurable 900 KB threshold as the existing autoloaded options check.
Implementation
The check uses wp option list with the transients, autoload and total_bytes options.
The required filtering was corrected in wp-cli/entity-command#620 and released in Entity Command v2.8.12. The minimum dependency has therefore been updated to ^2.8.12.
Testing
Fixes #150
Summary by CodeRabbit
New Features
transients-sizecheck to the default Doctor configuration.Tests