Skip to content

Commit

Permalink
Reduce pool maintenance delay and update debug mode check
Browse files Browse the repository at this point in the history
The worker pool maintenance delay has been reduced from 10,000 to 1,000 units in WorkerPool.php for smoother operation. In Utils.php, the check for debug mode has been changed from a defined constant to a variable, enhancing maintainability and effectiveness of debug mode functionality.
  • Loading branch information
SmetDenis committed Apr 11, 2024
1 parent 04f1292 commit c3f3d0a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static function debug(string $message): void

public static function debugSpeed(string $messPrefix, int $lines, float $startTimer): void
{
if (\defined('DEBUG_MODE')) {
if (self::$debugMode) {
$kiloLines = \round(($lines / (\microtime(true) - $startTimer)) / 1000);
self::debug("{$messPrefix} <blue>" . \number_format($kiloLines) . 'K</blue> lines/sec');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Workers/WorkerPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
final class WorkerPool
{
private const FALLBACK_CPU_COUNT = 1;
private const POOL_MAINTENANCE_DELAY = 10_000; // Small delay to prevent overload CPU
private const POOL_MAINTENANCE_DELAY = 1_000; // Small delay to prevent overload CPU

private static ?string $bootstrap = null;
private int $maxThreads;
Expand Down

0 comments on commit c3f3d0a

Please sign in to comment.