Skip to content

[feat] fs.watch - #3249

Merged
Jarred-Sumner merged 18 commits into
mainfrom
ciro/fs-watch
Jun 24, 2023
Merged

Jarred-Sumner merged 18 commits into
mainfrom
ciro/fs-watch

Conversation

@cirospaciari

Copy link
Copy Markdown
Member

No description provided.

@github-actions

github-actions Bot commented Jun 8, 2023 •

Copy link
Copy Markdown
Contributor

❌ @cirospaciari 9 files with test failures on linux-x64:

  • test/bundler/bundler_browser.test.ts
  • test/bundler/esbuild/default.test.ts
  • test/bundler/esbuild/importstar.test.ts
  • test/cli/install/bunx.test.ts
  • test/js/bun/util/inspect.test.js
  • test/js/bun/websocket/websocket-server.test.ts
  • test/js/third_party/napi_create_external/napi-create-external.test.ts
  • test/js/third_party/prisma/prisma.test.ts
  • test/js/web/websocket/websocket.test.js

View test output

#42f1b6d40b33a952ac17a12bb17ee1aec007e152

@github-actions

github-actions Bot commented Jun 8, 2023 •

Copy link
Copy Markdown
Contributor

❌ @cirospaciari 8 files with test failures on linux-x64-baseline:

  • test/bundler/bundler_browser.test.ts
  • test/bundler/esbuild/default.test.ts
  • test/bundler/esbuild/importstar.test.ts
  • test/cli/install/bunx.test.ts
  • test/js/bun/util/inspect.test.js
  • test/js/bun/websocket/websocket-server.test.ts
  • test/js/third_party/prisma/prisma.test.ts
  • test/js/web/websocket/websocket.test.js

View test output

#42f1b6d40b33a952ac17a12bb17ee1aec007e152

@github-actions

github-actions Bot commented Jun 8, 2023 •

Copy link
Copy Markdown
Contributor

❌ @cirospaciari 12 files with test failures on bun-darwin-x64-baseline:

  • test/bundler/bundler_browser.test.ts
  • test/bundler/esbuild/default.test.ts
  • test/bundler/esbuild/importstar.test.ts
  • test/cli/install/bunx.test.ts
  • test/js/bun/spawn/spawn-streaming-stdin.test.ts
  • test/js/bun/sqlite/sqlite.test.js
  • test/js/bun/util/inspect.test.js
  • test/js/bun/util/sleepSync.test.ts
  • test/js/bun/websocket/websocket-server.test.ts
  • test/js/web/timers/setInterval.test.js
  • test/js/web/timers/setTimeout.test.js
  • test/js/web/websocket/websocket.test.js

View test output

#42f1b6d40b33a952ac17a12bb17ee1aec007e152

@github-actions

github-actions Bot commented Jun 15, 2023 •

Copy link
Copy Markdown
Contributor

❌ @cirospaciari 10 files with test failures on bun-darwin-aarch64:

  • test/bundler/bundler_browser.test.ts
  • test/bundler/esbuild/default.test.ts
  • test/bundler/esbuild/importstar.test.ts
  • test/cli/install/bunx.test.ts
  • test/js/bun/net/socket.test.ts
  • test/js/bun/test/test-test.test.ts
  • test/js/bun/util/inspect.test.js
  • test/js/bun/websocket/websocket-server.test.ts
  • test/js/web/fetch/fetch-leak.test.js
  • test/js/web/websocket/websocket.test.js

View test output

#42f1b6d40b33a952ac17a12bb17ee1aec007e152

@cirospaciari
cirospaciari marked this pull request as ready for review June 16, 2023 11:20
@github-actions

github-actions Bot commented Jun 18, 2023 •

Copy link
Copy Markdown
Contributor

✅ prettier errors have been resolved. Thank you.

#42f1b6d40b33a952ac17a12bb17ee1aec007e152

Comment thread src/js/out/modules/node/fs.js Outdated
@cirospaciari

cirospaciari commented Jun 22, 2023 •

Copy link
Copy Markdown
Member Author

@Jarred-Sumner

Today once initialized we never deinit this loop, but we can deinit it when no watchers are active https://github.com/oven-sh/bun/blob/a448078534811b8e2ecba1df1309e4101ab12a88/src/bun.js/node/fs_events.zig#L541-L563

This implementation is also using babylist to keep track of active stuff and we reuse free slots, not the optimal way but should be fine when using 1-100 watchers https://github.com/oven-sh/bun/blob/a448078534811b8e2ecba1df1309e4101ab12a88/src/bun.js/node/fs_events.zig#L501-L508

This is the main logic https://github.com/oven-sh/bun/blob/a448078534811b8e2ecba1df1309e4101ab12a88/src/bun.js/node/fs_events.zig#L355-L406
and we use 1 thread for all watchers and just filter by path like uv does, watcher.zig is using 1 thread per watcher and maybe we can refactor it to do the same as fs_events, relative path logic is also much simpler on fs_events loop.

@Jarred-Sumner
Jarred-Sumner merged commit 069b42a into main Jun 24, 2023
@Jarred-Sumner
Jarred-Sumner deleted the ciro/fs-watch branch June 24, 2023 06:24
@Jarred-Sumner

Copy link
Copy Markdown
Collaborator

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants