diff options
author | 2022-12-06 17:09:21 -0800 | |
---|---|---|
committer | 2022-12-06 17:10:14 -0800 | |
commit | 5f3a6f2bf3b91c6c4fa0ad7f4197863ef6980889 (patch) | |
tree | d34b52c4620abafe6b669ce1e8c65cc147ea8741 /src | |
parent | 58185e139a9c8502e5a6afcd5ab5f9682552a731 (diff) | |
download | bun-5f3a6f2bf3b91c6c4fa0ad7f4197863ef6980889.tar.gz bun-5f3a6f2bf3b91c6c4fa0ad7f4197863ef6980889.tar.zst bun-5f3a6f2bf3b91c6c4fa0ad7f4197863ef6980889.zip |
add server scheduleDeinit, ignore logs in test
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/api/server.zig | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bun.js/api/server.zig b/src/bun.js/api/server.zig index f9ca6e881..a8216c689 100644 --- a/src/bun.js/api/server.zig +++ b/src/bun.js/api/server.zig @@ -3804,7 +3804,7 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { listen_callback: JSC.AnyTask = undefined, allocator: std.mem.Allocator, poll_ref: JSC.PollRef = .{}, - + deinit_scheduled: bool = false, temporary_url_buffer: std.ArrayListUnmanaged(u8) = .{}, pub const Class = JSC.NewClass( @@ -4291,7 +4291,7 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { ws.handler.app = null; } this.unref(); - this.deinit(); + this.scheduleDeinit(); } } @@ -4307,6 +4307,16 @@ pub fn NewServer(comptime ssl_enabled_: bool, comptime debug_mode_: bool) type { this.deinitIfWeCan(); } + pub fn scheduleDeinit(this: *ThisServer) void { + if (this.deinit_scheduled) + return; + this.deinit_scheduled = true; + httplog("scheduleDeinit", .{}); + var task = bun.default_allocator.create(JSC.AnyTask) catch unreachable; + task.* = JSC.AnyTask.New(ThisServer, deinit).init(this); + this.vm.enqueueTask(JSC.Task.init(task)); + } + pub fn deinit(this: *ThisServer) void { httplog("deinit", .{}); this.app.destroy(); |