Skip to content

Commit 3c07c08

Browse files
committed
improve variable names
1 parent 55e02f0 commit 3c07c08

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/browser/page.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ pub const Page = struct {
144144
return self.fetchData("module", src);
145145
}
146146

147-
pub fn wait(self: *Page, wait_time: usize) !void {
147+
pub fn wait(self: *Page, wait_ns: usize) !void {
148148
var try_catch: Env.TryCatch = undefined;
149149
try_catch.init(self.main_context);
150150
defer try_catch.deinit();
151151

152-
try self.session.browser.app.loop.run(wait_time);
152+
try self.session.browser.app.loop.run(wait_ns);
153153

154154
if (try_catch.hasCaught() == false) {
155155
log.debug(.browser, "page wait complete", .{});

src/runtime/loop.zig

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ const MemoryPool = std.heap.MemoryPool;
2323
const log = @import("../log.zig");
2424
pub const IO = @import("tigerbeetle-io").IO;
2525

26+
const RUN_DURATION = 10 * std.time.ns_per_ms;
27+
2628
// SingleThreaded I/O Loop based on Tigerbeetle io_uring loop.
2729
// On Linux it's using io_uring.
2830
// On MacOS and Windows it's using kqueue/IOCP with a ring design.
@@ -82,7 +84,7 @@ pub const Loop = struct {
8284
// run tail events. We do run the tail events to ensure all the
8385
// contexts are correcly free.
8486
while (self.pending_network_count != 0 or self.pending_timeout_count != 0) {
85-
self.io.run_for_ns(std.time.ns_per_ms * 10) catch |err| {
87+
self.io.run_for_ns(RUN_DURATION) catch |err| {
8688
log.err(.loop, "deinit", .{ .err = err });
8789
break;
8890
};
@@ -102,12 +104,12 @@ pub const Loop = struct {
102104
// Stops when there is no more I/O events registered on the loop.
103105
// Note that I/O events callbacks might register more I/O events
104106
// on the go when they are executed (ie. nested I/O events).
105-
pub fn run(self: *Self, wait_time: usize) !void {
107+
pub fn run(self: *Self, wait_ns: usize) !void {
106108
// stop repeating / interval timeouts from re-registering
107109
self.stopping = true;
108110
defer self.stopping = false;
109111

110-
const max_iterations = wait_time / (std.time.ns_per_ms * 10);
112+
const max_iterations = wait_ns / (RUN_DURATION);
111113
for (0..max_iterations) |_| {
112114
if (self.pending_network_count == 0 and self.pending_timeout_count == 0) {
113115
break;

0 commit comments

Comments
 (0)