Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watch events don't emit when it creates a directory in the course of creating a record #39

Open
carltonwhitehead opened this issue Dec 14, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@carltonwhitehead
Copy link
Contributor

Steps to repeat issue:

  1. Given a database with an entity definition calling for records stored in a subfolder, ie { "widgets" / id + ".json" }
  2. Initialize the database into an empty folder. Crucially, the subfolder for the entities must not exist, ie widgets/
  3. On the resource for the entity, watch() to observe changes
  4. Instantiate an instance of the entity and pass it to the resource's create(E) method

Expected results:
The watch observer emits an event indicating the entity exists

Actual results:
The watch observer doesn't emit anything

@carltonwhitehead carltonwhitehead added the bug Something isn't working label Dec 14, 2022
@carltonwhitehead
Copy link
Contributor Author

This bug affects Linux. Not sure about other OS.

I suspect it might be caused by the JVM's underlying use of inotify on Linux to support filesystem watches. From the inotify man page:

If monitoring an entire directory subtree, and a new subdirectory is created in that tree, be aware that by the time you create a watch for the new subdirectory, new files may already have been created in the subdirectory. Therefore, you may want to scan the contents of the subdirectory immediately after adding the watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant