File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -35,14 +35,6 @@ public function isCoroutineRuntime(): bool
3535 return false ;
3636 }
3737
38- /**
39- * 判断是否运行在Workerman环境中
40- */
41- public function isWorkerman (): bool
42- {
43- return class_exists (\Workerman \Worker::class) && \Workerman \Worker::$ pidFile !== '' ;
44- }
45-
4638 public function isSwoole (): bool
4739 {
4840 return class_exists (\Swoole \Coroutine::class) && \Swoole \Coroutine::getCid () > 0 ;
@@ -75,7 +67,10 @@ public function defer(callable $callback): void
7567 return ;
7668 }
7769
78- if ($ this ->isWorkerman ()) {
70+ if (class_exists (\Workerman \Worker::class)
71+ && \Workerman \Worker::$ pidFile !== ''
72+ && class_exists (\Workerman \Timer::class)
73+ ) {
7974 \Workerman \Timer::add (0.001 , $ callback , persistent: false );
8075 return ;
8176 }
You can’t perform that action at this time.
0 commit comments