Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Expected Events API #137

Open
1 task done
Arcanemagus opened this issue Apr 17, 2018 · 0 comments
Open
1 task done

Expected Events API #137

Arcanemagus opened this issue Apr 17, 2018 · 0 comments

Comments

@Arcanemagus
Copy link

Prerequisites

Description

There are some terrible file systems out there that send some events (file creation/deletion), but fail to send other events (file modifications). Since @atom/watcher sees the initial events it doesn't consider that it needs to fall back to polling for this file system, which ends it up in a state where it can only detect when a file has been created or deleted.

Expected Events

One way that this could be solved is an "expected events" API, where the client (Atom) sends a message when it thinks there should be an event happening, then @atom/watcher will immediately emit the event back... but watch for the real event from the file system. If it gets the real event within a threshold it marks the file system as correctly sending that specific event type and ignores the real event. If the real event is never seen before the threshold expires the filesystem is marked as "problematic" for that event and @atom/watcher will know that it needs to poll for changes on that root.

Advantages
  • Known events are emitted back immediately
  • No additional I/O for filesystem capability checks
Disadvantages
  • Added complexity of interacting with @atom/watcher
  • Will fail to detect externally triggered events till the client does I/O on a file under the root being watched

Token files

An alternative solution that has been talked about before is having @atom/watcher create its own "token" file within the filesystem root to check if the events are properly being emitted for the file.

Advantages
  • Will know as soon as the token file I/O is complete whether the filesystem works correctly or not
Disadvantages
  • Additional I/O work for the token file
  • Has to write a file for every root
  • Doesn't work for read only file systems

Steps to Reproduce

  1. Have a terrible file system that sends some events but not most
  2. Watch @atom/watcher fail to see modification events
  3. Think of a way to get around this

Expected behavior:

@atom/watcher works everywhere, all the time.

Actual behavior:

It doesn't.

Reproduces how often:

100% of the time.

Versions

All of them up till this gets fixed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant