Open
Conversation
| const events = new Map<number, { event: Watcher.SuccessEvent; timer: NodeJS.Timeout }>(); | ||
| const DEBOUNCE_MS = process.env.NODE_ENV === 'test' ? 50 : 2000; | ||
|
|
||
| function onEvent({ ctx, event }: { ctx: SyncContext; event: Watcher.Event }) { |
Contributor
Author
There was a problem hiding this comment.
This is the main change of this PR.
| await sleep(100); | ||
| await checkIfModified(props); | ||
| await sleep(100); | ||
| return; |
Contributor
Author
There was a problem hiding this comment.
We fix this in the next PR.
| // When | ||
| await writeFile(file, 'content'); | ||
| await sleep(3000); | ||
| return; |
Contributor
Author
There was a problem hiding this comment.
We fix this in the next PR.
| timeout = setTimeout(async () => { | ||
| timeouts.delete(path); | ||
| await onChange({ ctx, path }); | ||
| await onChange({ ctx, path } as any); |
Contributor
Author
There was a problem hiding this comment.
This file will be deleted in the next PR.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Refactor the watcher in C++. Now we are going to obtain the extended information from windows, which includes an
internalId,size,mtimeandctime. We are going to send all events to javascript and there we are going to log them and group by internalId. The timeout to group is 2s. After that, if we are 2s without having any new event of aninternalIdwe process that last event received with thatinternalId. This improve the issue of the move operation (it sends adeleteevent and after that acreateevent) and also the one of locked files (it sends acreateevent with size 0 and then manyupdateevents with size X until it reaches the final size Y). This second case it's more tricky to test since I don't know how much time can we expect from oneupdateto another. I've added a test for that but probably we will need to continue improving this part.