aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/web_worker.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-08-29 21:17:56 -0700
committerGravatar GitHub <noreply@github.com> 2023-08-29 21:17:56 -0700
commitc028b206bce3f9b5c3cba7899c6bf34856efe43f (patch)
treec5248e13572ad76ebff5952308f01b788cde71ed /src/bun.js/web_worker.zig
parenta846852818278641cf33413ce784adf2fc0e2e52 (diff)
downloadbun-c028b206bce3f9b5c3cba7899c6bf34856efe43f.tar.gz
bun-c028b206bce3f9b5c3cba7899c6bf34856efe43f.tar.zst
bun-c028b206bce3f9b5c3cba7899c6bf34856efe43f.zip
Fix assertion failure in spawn-related tests (#4400)
* Clean up some of the event loop code * Support timeouts * Defer freeing FilePoll --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/web_worker.zig')
-rw-r--r--src/bun.js/web_worker.zig5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/bun.js/web_worker.zig b/src/bun.js/web_worker.zig
index e9c9637b9..b4de8aad2 100644
--- a/src/bun.js/web_worker.zig
+++ b/src/bun.js/web_worker.zig
@@ -263,8 +263,7 @@ pub const WebWorker = struct {
this.setStatus(.running);
// don't run the GC if we don't actually need to
- if (vm.eventLoop().tasks.count > 0 or vm.active_tasks > 0 or
- vm.event_loop_handle.?.active > 0 or
+ if (vm.isEventLoopAlive() or
vm.eventLoop().tickConcurrentWithCount() > 0)
{
vm.global.vm().releaseWeakRefs();
@@ -275,7 +274,7 @@ pub const WebWorker = struct {
// always doing a first tick so we call CppTask without delay after dispatchOnline
vm.tick();
- while (vm.eventLoop().tasks.count > 0 or vm.active_tasks > 0 or vm.event_loop_handle.?.active > 0) {
+ while (vm.isEventLoopAlive()) {
vm.tick();
if (this.requested_terminate) break;
vm.eventLoop().autoTickActive();