vector icon indicating copy to clipboard operation
vector copied to clipboard

enhancement(config): Remove the watcher's coupling to SIGHUP / prepare for automatic Windows config reload

Open darklajid opened this issue 6 months ago • 4 comments

Right now the watcher is broken/unimplemented for Windows¹ and a large part of the reason for that might be how it works:

  • the watcher subscribes to filesystem events (crate: notify²)
  • the watcher raises a unix signal (SIGHUP) on detecting changes
  • the signal handler (again, unix only) reacts to SIGHUP with an internal reload signal
  • (vector magically reloads/compares the configs)

With these changes that unix signal dependency is removed

  • the watcher clones a SignalTx to emit its very own signals
  • the watcher sends an internal reload signal on detecting changes
  • (vector magically reloads/compares the configs)

All of this should also work on Windows, has nothing to do with unix signals anymore.

I slightly modified the tests to not just wait for any Ok, but to state explicitly what signal we expect to receive.

As I am currently (and ironically..) on Linux, I haven't been able to verify the functionality on Windows yet, I'm trying to build a VM for that at the moment. I also expect fun challenges to build the dependencies on Windows.

For Linux, the tests remain green and this seems to be a transparent change to me: I don't think that affects any users, a SIGHUP works the same way it did before and just the filesystem change events don't go through that indirection anymore.

①: It fails outright/intentionally on Windows with an error pointing to https://github.com/vectordotdev/vector/issues/938, but it's unclear why this can't work ②: Notify officially supports native filesystem watches (and - as on all platforms - a polling fallback) on Windows

darklajid avatar Aug 02 '24 09:08 darklajid