Update watcher.md

This commit is contained in:
黄朝晖 2020-12-29 15:09:20 +08:00 committed by GitHub
parent a7a44fd447
commit c1d0319de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,8 @@
# Code Update Watcher
Since version `2.0` uses `BetterReflection` to collect the `syntax tree` and `reflection data` in the scanned directory, the scanning speed is much slower than version `1.1`.
Since version `2.0` uses `BetterReflection` to collect the `abstract syntax tree (AST)` and `reflection data`, the scanning speed is much slower than version `1.1`.
> The first application startup will be slower because there is no cache. The startup process should be sped up by subsequent dynamic startups, but because `BetterReflection` needs to be instantiated, the startup time is still relatively long.
> The first startup of application will be slower because there is no scan cache exists. Subsequent startup speeds will be improved, but because `BetterReflection` needs to be instantiated, the startup time is still relatively long.
In addition to solving the above startup problems, the `Watcher` component also handles restarting the application immediately after file modification.
@ -40,13 +40,13 @@ php bin/hyperf.php vendor:publish hyperf/watcher
| Hyperf\Watcher\Driver\FindDriver | requires findMAC requires gfind |
### `fswatch` Installation
Mac
Mac:
```bash
brew install fswatch
```
Other systems
Linux:
```bash
wget https://github.com/emcrisostomo/fswatch/releases/download/1.14.0/fswatch-1.14.0.tar.gz \
@ -67,6 +67,6 @@ php bin/hyperf.php server:watch
## Problems
- For the time being, there is a slight problem in the Alpine Docker environment, which will be improved in the future.
- Deletion of files and modification of .env require a manual restart to take effect.
- Files in the vendor need to be automatically loaded in the form of classmap before they can be scanned. (I.e. execute composer dump-autoload -o)
- For now, there is a slight problem in the Alpine Docker environment, which will be improved in the future version.
- Deletion of files and modification of `.env` require a manual restart to take effect.
- Files in the `vendor` need to be automatically loaded in the form of classmap before they can be scanned. (i.e. execute `composer dump-autoload -o`)