Browse Source

Add timeout to curl

master
Kenneth Bruen 9 months ago
parent
commit
571de3b24e
Signed by: kbruen
GPG Key ID: C1980A470C3EE5B1
  1. 2
      src/departure.zig
  2. 2
      src/home.zig

2
src/departure.zig

@ -65,6 +65,8 @@ fn fetchThread(state: *AppState) !void {
defer result.deinit(); defer result.deinit();
_ = curl.setopt(.write_function, Curl.Utils.array_list_append); _ = curl.setopt(.write_function, Curl.Utils.array_list_append);
_ = curl.setopt(.write_data, &result); _ = 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(); const code = curl.perform();
std.debug.print("[departure/fetchThread] cURL Code: {}\n", .{code}); std.debug.print("[departure/fetchThread] cURL Code: {}\n", .{code});

2
src/home.zig

@ -44,6 +44,8 @@ fn fetchThread(state: *AppState) !void {
defer result.deinit(); defer result.deinit();
_ = curl.setopt(.write_function, Curl.Utils.array_list_append); _ = curl.setopt(.write_function, Curl.Utils.array_list_append);
_ = curl.setopt(.write_data, &result); _ = 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(); const code = curl.perform();
std.debug.print("[home/fetchThread] cURL Code: {}\n", .{code}); std.debug.print("[home/fetchThread] cURL Code: {}\n", .{code});

Loading…
Cancel
Save