Skip to content

Commit

Permalink
Do not flush FSEventStream
Browse files Browse the repository at this point in the history
Doing so produces this log:

2020-02-17 23:02 java[50430] (FSEvents.framework) FSEventStreamFlushSync(): failed assertion '(SInt64)last_id > 0LL'

The recommendation seems to be not to call FSEventStreamFlushSync() at all.
  • Loading branch information
lptr committed Feb 18, 2020
1 parent decc683 commit 41f3826
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/cpp/apple_fsnotifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,16 @@ void Server::run() {

CFRunLoopRun();

FSEventStreamFlushSync(watcherStream);
// Reading the Apple docs it seems we should call FSEventStreamFlushSync() here.
// But doing so produces this log:
//
// 2020-02-17 23:02 java[50430] (FSEvents.framework) FSEventStreamFlushSync(): failed assertion '(SInt64)last_id > 0LL'
//
// According to this comment we should not use flush at all, and it's probably broken:
// https://github.com/nodejs/node/issues/854#issuecomment-294892950
// As the comment mentions, even Watchman doesn't flush:
// https://github.com/facebook/watchman/blob/b397e00cf566f361282a456122eef4e909f26182/watcher/fsevents.cpp#L276-L285
// FSEventStreamFlushSync(watcherStream);
FSEventStreamStop(watcherStream);
FSEventStreamInvalidate(watcherStream);

Expand Down

0 comments on commit 41f3826

Please sign in to comment.