From 571de3b24ea8c7d3d55ebe20096f0b603a3761dc Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Wed, 21 Feb 2024 19:08:30 +0100 Subject: [PATCH] Add timeout to curl --- src/departure.zig | 2 ++ src/home.zig | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/departure.zig b/src/departure.zig index e5a8e1d..270225e 100644 --- a/src/departure.zig +++ b/src/departure.zig @@ -65,6 +65,8 @@ fn fetchThread(state: *AppState) !void { defer result.deinit(); _ = curl.setopt(.write_function, Curl.Utils.array_list_append); _ = curl.setopt(.write_data, &result); + _ = curl.setopt(.low_speed_limit, @as(c_long, 128)); + _ = curl.setopt(.low_speed_time, @as(c_long, 5)); const code = curl.perform(); std.debug.print("[departure/fetchThread] cURL Code: {}\n", .{code}); diff --git a/src/home.zig b/src/home.zig index 6396b2a..33024be 100644 --- a/src/home.zig +++ b/src/home.zig @@ -44,6 +44,8 @@ fn fetchThread(state: *AppState) !void { defer result.deinit(); _ = curl.setopt(.write_function, Curl.Utils.array_list_append); _ = curl.setopt(.write_data, &result); + _ = curl.setopt(.low_speed_limit, @as(c_long, 128)); + _ = curl.setopt(.low_speed_time, @as(c_long, 5)); const code = curl.perform(); std.debug.print("[home/fetchThread] cURL Code: {}\n", .{code});