PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
← All changes | jetpack_vendor/automattic/jetpack-sync/src/class-health.php +18 -0 13.3.3 → 16.3 View file →
@@ -174,8 +174,26 @@
174 174 }
175 175 }
176 176
177 177 /**
178 + * Check if the sync queue is healthy based on size and lag.
179 + *
180 + * The queue is considered healthy if either size OR lag is within its limit.
181 + * This matches the logic in Listener::can_add_to_queue(): data loss only occurs
182 + * when both limits are exceeded simultaneously.
183 + *
184 + * @param int $queue_size Current queue size.
185 + * @param float $queue_lag Current queue lag in seconds.
186 + * @param int $max_queue_size Maximum allowed queue size.
187 + * @param float $max_queue_lag Maximum allowed queue lag in seconds.
188 + * @return bool Whether the queue is healthy.
189 + */
190 + public static function is_queue_healthy( $queue_size, $queue_lag, $max_queue_size, $max_queue_lag ) {
191 + return ( $queue_size < $max_queue_size )
192 + || ( $queue_lag < $max_queue_lag );
193 + }
194 +
195 + /**
178 196 * Update Sync Status if Full Sync ended of Posts
179 197 *
180 198 * @param string $checksum The checksum that's currently being processed.
181 199 * @param array $range The ranges of object types being processed.