| Conditions | 3 |
| Paths | 2 |
| Total Lines | 16 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | public static function callback(Server $swoole, SwooleProcess $process) |
||
| 30 | { |
||
| 31 | $filename = base_path('.env'); |
||
| 32 | if (isset($_ENV['_ENV'])) { |
||
| 33 | $filename .= '.' . $_ENV['_ENV']; |
||
| 34 | } |
||
| 35 | |||
| 36 | self::$apollo = Client::createFromEnv(); |
||
| 37 | self::$apollo->startWatchNotification(function (array $notifications) use ($process, $filename) { |
||
| 38 | $configs = self::$apollo->pullAllAndSave($filename); |
||
| 39 | app('log')->info('[ApolloProcess] Pull all configurations', $configs); |
||
| 40 | Portal::runLaravelSCommand(base_path(), 'reload'); |
||
| 41 | if (Context::inCoroutine()) { |
||
| 42 | Coroutine::sleep(5); |
||
| 43 | } else { |
||
| 44 | sleep(5); |
||
| 45 | } |
||
| 54 | } |