Skip to content

Commit

Permalink
statusFile
Browse files Browse the repository at this point in the history
  • Loading branch information
walkor committed Feb 10, 2022
1 parent 8735ee0 commit d278764
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,11 @@ class Worker
public static $pidFile = '';

/**
* Phar support.
* The filename prefix used to store the master process status file.
* Allow user-defined file paths to store the master process status file.
* The file used to store the master process status file.
*
* @var string
*/
public static $statisticsFileNamePrefix = '';
public static $statusFile = '';

/**
* Log file.
Expand Down Expand Up @@ -654,7 +652,7 @@ protected static function initWorkers()
return;
}

static::$_statisticsFile = !empty(static::$statisticsFileNamePrefix) ? static::$statisticsFileNamePrefix . posix_getpid().'.status' : __DIR__ . '/../workerman-' .posix_getpid().'.status';
static::$_statisticsFile = static::$statusFile ? static::$statusFile : __DIR__ . '/../workerman-' .posix_getpid().'.status';

foreach (static::$_workers as $worker) {
// Worker name.
Expand Down Expand Up @@ -932,7 +930,7 @@ protected static function parseCommand()
exit;
}

$statistics_file = !empty(static::$statisticsFileNamePrefix) ? static::$statisticsFileNamePrefix . "$master_pid.status" : __DIR__ . "/../workerman-$master_pid.status";
$statistics_file = static::$statusFile ? static::$statusFile : __DIR__ . "/../workerman-$master_pid.status";

// execute command.
switch ($command) {
Expand Down

0 comments on commit d278764

Please sign in to comment.