Skip to content

Commit 7e8d667

Browse files
committed
cleancode
1 parent 6710b45 commit 7e8d667

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ worker 进程会自动在其后追加 worker 文本,最终的进程名称为 `
143143

144144
worker 进程退出后是否自动补充新的进程,`默认为 true,自动补充新的进程`
145145

146-
如果不想自动补充退出的进程,请可以设置 `refork``false;`
146+
如果不想自动补充退出的进程,可以设置 `refork``false;`
147147

148148

149149
## 信号处理

src/Process.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ protected function forkWorker($id)
6868
static::$isMaster = false;
6969
$this->id = $id;
7070
$this->workerPid = posix_getpid();
71-
7271
$this->setProcName();
7372

7473
// Run worker.
@@ -122,7 +121,7 @@ protected function redirectStd()
122121
fclose(STDOUT);
123122
fclose(STDERR);
124123

125-
$logFile = $this->logFile ? $this->logFile : '/dev/null';
124+
$logFile = $this->logFile ?: '/dev/null';
126125

127126
global $stdin, $stdout, $stderr;
128127
$stdin = fopen('/dev/null', 'r');
@@ -167,7 +166,7 @@ protected function setProcName()
167166

168167
protected function run()
169168
{
170-
register_shutdown_function([$this, 'handleShutdown']);
169+
register_shutdown_function([$this, 'handleFatalError']);
171170

172171
try {
173172
$this->log("[worker:{$this->id} {$this->workerPid}] process started");
@@ -179,7 +178,7 @@ protected function run()
179178
}
180179
}
181180

182-
public function handleShutdown()
181+
public function handleFatalError()
183182
{
184183
$errmsg = "[worker:{$this->id} {$this->workerPid}] process terminated";
185184
// Handle last error.

0 commit comments

Comments
 (0)