-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Hi SpinupWP team,
Lately we've been encountering several fatal errors across multiple servers/sites using Redis caching. The problem is when the SpinupWP plug-in tries to purge the Redis caches, the following error appears:
Error establishing a Redis connection. socket error on read socket.
This isn’t a Redis connection issue per se — Redis itself only logs a slow script:
757:M 27 Mar 2025 15:37:34.665 # Slow script detected: still in execution after 5137 milliseconds. You can try killing the script using the SCRIPT KILL command. Script name is: d41069bcd2020f6c3be92bfd8627cc8b743778ac.
This error comes from phpredis, which is used in the object-cache.php drop-in placed by SpinupWP. The connection timeout is defined in the build_parameters() method :
'timeout' => 5,
'read_timeout' => 5,
Unfortunately, there's currently no way to override these values. We’d like to increase the timeouts since certain cache flushes can legitimately take longer than 5 seconds.
Feature Request
Could you consider one of the following approaches?
Allow overriding these values via WP_REDIS_TIMEOUT and WP_REDIS_READ_TIMEOUT constants (similar to WP_REDIS_DISABLED).
Or, if feasible within the drop-in context, introduce WordPress filters for more granular control.
This would give us a clean way to adapt Redis behavior to real-world workloads, especially on high-traffic or WooCommerce-heavy sites.
Another option would be to set the timeout and read_timeout to the default 0, so we can leverage the default_socket_timeout as SpinupWP allows us to override the fpm's ini on a per-site level.
Thanks in advance — happy to help test or PR this if helpful!
P.S.: It has also been increased from 1 to 5 in the past (#70), but it seems to me that the value of 5 is still too low for larger sites.