Skip to content

Commit

Permalink
Optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed Dec 11, 2024
1 parent 42de118 commit 81a3175
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Worker
*
* @var string
*/
final public const VERSION = '5.0.0-rc.4';
final public const VERSION = '5.0.0-rc.5';

/**
* Status starting.
Expand Down Expand Up @@ -297,21 +297,21 @@ class Worker
*
* @var string
*/
public static string $pidFile;
public static string $pidFile = '';

/**
* The file used to store the master process status.
*
* @var string
*/
public static string $statusFile;
public static string $statusFile = '';

/**
* Log file.
*
* @var string
*/
public static string $logFile;
public static string $logFile = '';

/**
* Global event loop.
Expand Down Expand Up @@ -446,21 +446,21 @@ class Worker
*
* @var string
*/
protected static string $statisticsFile;
protected static string $statisticsFile = '';

/**
* The file to store status info of connections.
*
* @var string
*/
protected static string $connectionsFile;
protected static string $connectionsFile = '';

/**
* Start file.
*
* @var string
*/
protected static string $startFile;
protected static string $startFile = '';

/**
* Processes for windows.
Expand Down Expand Up @@ -723,15 +723,15 @@ protected static function init(): void
}

// Pid file.
static::$pidFile ??= sprintf('%s/workerman.%s.pid', $startFileDir, $startFilePrefix);
static::$pidFile = static::$pidFile ?: sprintf('%s/workerman.%s.pid', $startFileDir, $startFilePrefix);

// Status file.
static::$statusFile ??= sprintf('%s/workerman.%s.status', $startFileDir, $startFilePrefix);
static::$statisticsFile ??= static::$statusFile;
static::$connectionsFile ??= static::$statusFile . '.connection';
static::$statusFile = static::$statusFile ?: sprintf('%s/workerman.%s.status', $startFileDir, $startFilePrefix);
static::$statisticsFile = static::$statisticsFile ?: static::$statusFile;
static::$connectionsFile = static::$connectionsFile ?: static::$statusFile . '.connection';

// Log file.
static::$logFile ??= sprintf('%s/workerman.log', $startFileDir);
static::$logFile = static::$logFile ?: sprintf('%s/workerman.log', $startFileDir);

if (static::$logFile !== '/dev/null' && !is_file(static::$logFile)) {
// if /runtime/logs default folder not exists
Expand Down

0 comments on commit 81a3175

Please sign in to comment.