完善FindDriver热更新 (#2193)

* 完善FindDriver热更新

* Update CHANGELOG-2.0.md

Co-authored-by: zhangzibin <zhangzibin@ecomxhat.com>
Co-authored-by: 李铭昕 <715557344@qq.com>
This commit is contained in:
张子彬 2020-07-28 17:19:12 +08:00 committed by GitHub
parent c224ba6922
commit 862a0a824e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -1,5 +1,9 @@
# v2.0.5 - TBD
## Optimized
- [#2193](https://github.com/hyperf/hyperf/pull/2193) Optimized the scan accuracy for `Hyperf\Watcher\Driver\FindDriver`.
# v2.0.4 - 2020-07-27
## Added

View File

@ -56,7 +56,7 @@ class FindDriver implements DriverInterface
}
$seconds = ceil(($ms + 1000) / 1000);
$minutes = sprintf('%.2f', $seconds / 60);
$minutes = sprintf('-%.2f', $seconds / 60);
[$fileModifyTimes, $changedFiles] = $this->scan($fileModifyTimes, $minutes);
@ -70,6 +70,10 @@ class FindDriver implements DriverInterface
{
$changedFiles = [];
$dest = implode(' ', $targets);
/**
* In linux system, you can use command below
* find app -mmin -0.05 -type f -printf "%p %T+\n"
*/
$ret = System::exec($this->getBin() . ' ' . $dest . ' -mmin ' . $minutes . ' -type f -printf "%p %T+' . PHP_EOL . '"');
if ($ret['code'] === 0 && strlen($ret['output'])) {
$stdout = $ret['output'];