diff options
author | 2022-11-11 00:20:23 -0800 | |
---|---|---|
committer | 2022-11-11 00:20:42 -0800 | |
commit | 1671e3cc7e7481d20f0e7716e4449cb0756f2b96 (patch) | |
tree | af5af59fdaa2fa0880950b059dd505ecd0c7d827 | |
parent | 24a85f8de6430620a493ee784a7617292b4c598f (diff) | |
download | bun-1671e3cc7e7481d20f0e7716e4449cb0756f2b96.tar.gz bun-1671e3cc7e7481d20f0e7716e4449cb0756f2b96.tar.zst bun-1671e3cc7e7481d20f0e7716e4449cb0756f2b96.zip |
Remove dead code
-rw-r--r-- | src/thread_pool.zig | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/thread_pool.zig b/src/thread_pool.zig index 4e811f71b..3c56da4b1 100644 --- a/src/thread_pool.zig +++ b/src/thread_pool.zig @@ -222,23 +222,12 @@ noinline fn notifySlow(self: *ThreadPool, is_waking: bool) void { } } -noinline fn wait(self: *ThreadPool, _is_waking: bool) error{Shutdown}!bool { - if (self.sleep_on_idle_network_thread and self.io != null) { - return _wait(self, _is_waking, true); - } - - return _wait(self, _is_waking, false); -} - -pub fn waitForIO(_: *ThreadPool) void {} - // sleep_on_idle seems to impact `bun install` performance negatively // so we can just not sleep for that -fn _wait(self: *ThreadPool, _is_waking: bool, comptime sleep_on_idle: bool) error{Shutdown}!bool { +noinline fn wait(self: *ThreadPool, _is_waking: bool) error{Shutdown}!bool { var is_idle = false; var is_waking = _is_waking; var sync = @bitCast(Sync, self.sync.load(.Monotonic)); - var checked_count: usize = 0; while (true) { if (sync.state == .shutdown) return error.Shutdown; @@ -296,35 +285,6 @@ fn _wait(self: *ThreadPool, _is_waking: bool, comptime sleep_on_idle: bool) erro io.tick() catch {}; } } else { - if (self.io) |io| { - if (comptime Environment.isLinux) - unreachable; - - const HTTP = @import("http"); - io.tick() catch {}; - - if (HTTP.AsyncHTTP.active_requests_count.loadUnchecked() > 0) { - var remaining_ticks: isize = 5; - - while (remaining_ticks > 0 and HTTP.AsyncHTTP.active_requests_count.loadUnchecked() > HTTP.AsyncHTTP.max_simultaneous_requests) : (remaining_ticks -= 1) { - io.run_for_ns(std.time.ns_per_ms * 2) catch {}; - io.tick() catch {}; - } - } - - if (sleep_on_idle and io.hasNoWork()) { - if (checked_count > 99999) { - HTTP.cleanup(false); - self.idle_event.waitFor(comptime std.time.ns_per_s * 60); - } else { - checked_count += 1; - } - } - - sync = @bitCast(Sync, self.sync.load(.Monotonic)); - continue; - } - self.idle_event.wait(); sync = @bitCast(Sync, self.sync.load(.Monotonic)); } |