Closed bytemain closed 3 months ago
此更新改进了FileSystemWatcherServer
类中的文件监视处理。主要变化包括添加了WATCHER_HANDLERS
映射来存储监视处理程序,以及重构了watchFileChanges
方法以更高效地处理监视初始化和事件处理。
文件路径 | 变更摘要 |
---|---|
packages/file-service/src/node/recursive/file-service-watcher.ts |
在FileSystemWatcherServer 类中添加了WATCHER_HANDLERS 映射,改进了watchFileChanges 方法的逻辑及事件处理。 |
sequenceDiagram
participant Client
participant FileSystemWatcherServer
participant FileUri
participant fs
Client->>FileSystemWatcherServer: watchFileChanges(uri, options)
FileSystemWatcherServer->>FileUri: fsPath(uri)
FileUri-->>FileSystemWatcherServer: basePath
FileSystemWatcherServer->>fs: pathExists(basePath)
fs-->>FileSystemWatcherServer: exist
alt exist
FileSystemWatcherServer->>Client: watcherId
FileSystemWatcherServer->>WATCHER_HANDLERS: set(watcherId, handler)
else exist not
FileSystemWatcherServer->>Client: Error
end
[!TIP]
AI model upgrade
## `gpt-4o` model for reviews and chat is now live OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our [Discord Community](https://discord.com/invite/GsXnASn26c) to provide any feedback or to report any issues.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🚅 Previously deployed to Railway in the core project. Environment has been deleted.
Attention: Patch coverage is 73.33333%
with 4 lines
in your changes missing coverage. Please review.
Project coverage is 55.04%. Comparing base (
e48311c
) to head (7bb07c5
). Report is 1 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
...service/src/node/recursive/file-service-watcher.ts | 73.33% | 4 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Types
Background or solution
之前的逻辑有判断要 watch 的路径是否已经被 watch 了,但是因为 async await 的原因,前端同时请求过来三四个一样的路径,后端会同时 watch 这些路径。
Changelog
fix file service will watch same folder multiple times
Summary by CodeRabbit