Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b4e022f
Add bun types
nazarhussain May 21, 2025
91104ac
Add bun implementation for process worker
nazarhussain May 21, 2025
6865643
Add isBun helper
nazarhussain May 22, 2025
c7d9340
Make sure worker port only have one listener
nazarhussain May 22, 2025
f73acba
Fix the worker thread pool
nazarhussain May 22, 2025
8b18276
Disable useAtomics for bun runtime
nazarhussain May 22, 2025
ce1470a
Update the check for resource limits
nazarhussain May 22, 2025
e6f31ec
Add bun test workflow
nazarhussain May 22, 2025
6c1fcbe
Update the vitest configuration
nazarhussain May 22, 2025
ab317e3
Revert changes for entry/worker.ts
nazarhussain May 23, 2025
276adb2
Fix tsconfig to point to js file instead decleration
nazarhussain May 23, 2025
cde9941
Fix lint issues
nazarhussain Jun 3, 2025
75c0dc1
Fix tests
nazarhussain Jun 3, 2025
a30652c
Remove custom bun process implementation
nazarhussain Jun 3, 2025
0b318a3
Remove bun types
nazarhussain Jun 3, 2025
20e1983
Revert changes to pnpm-lock
nazarhussain Jun 3, 2025
efc0479
Fix tsconfig to avoid error during bun run and typecheck
nazarhussain Jun 3, 2025
2c75bab
Update tear down tets
nazarhussain Jun 3, 2025
bdc159c
Update teardown test
nazarhussain Jun 3, 2025
223fb5a
Update code as per feedback
nazarhussain Jun 16, 2025
1281278
Use conditional execution for channel.unref
nazarhussain Jun 16, 2025
968d529
Merge branch 'main' into nh/bun-support
nazarhussain Jun 16, 2025
08e8143
fix: remove Bun specific exceptions from Node compatible code
AriPerkkio Jun 16, 2025
c42460e
test: exclude more tests from Bun
AriPerkkio Jun 16, 2025
bea6455
test: exclude more tests from Bun
AriPerkkio Jun 16, 2025
b413db0
ci: remove bun workflow
AriPerkkio Jun 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/entry/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ parentPort!.on('message', (message: StartupMessage) => {
const readyMessage: ReadyMessage = { ready: true }
parentPort!.postMessage(readyMessage)

port.start()

port.on('message', onMessage.bind(null, port, sharedBuffer))
atomicsWaitLoop(port, sharedBuffer)
})().catch(throwInNextTick)
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,8 @@ class ThreadPool {

worker.on('message', (message: ReadyMessage) => {
if (message.ready === true) {
port1.start()

if (workerInfo.currentUsage() === 0) {
workerInfo.unref()
}
Expand Down
3 changes: 2 additions & 1 deletion src/runtime/process-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default class ProcessWorker implements TinypoolWorker {
transferListItem?.forEach((item) => {
if (item instanceof MessagePort) {
this.port = item
this.port.start()
}
})

Expand Down Expand Up @@ -149,7 +150,7 @@ export default class ProcessWorker implements TinypoolWorker {

// The forked child_process adds event listener on `process.on('message)`.
// This requires manual unreffing of its channel.
this.process.channel?.unref()
this.process.channel?.unref?.()

if (hasUnref(this.process.stdout)) {
this.process.stdout.unref()
Expand Down