|
| 1 | +// SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | +// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
1 | 3 | // Docudactyl — Dragonfly / Redis RESP Client (L2 Cache) |
2 | 4 | // |
3 | 5 | // Minimal RESP2 client for Dragonfly (Redis-compatible) cross-locale cache. |
|
10 | 12 | // - 25x throughput on same hardware |
11 | 13 | // - Multi-threaded (no single-thread bottleneck) |
12 | 14 | // - Compatible with RESP2 protocol |
13 | | -// |
14 | | -// SPDX-License-Identifier: PMPL-1.0-or-later |
15 | | -// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk> |
16 | 15 |
|
17 | 16 | const std = @import("std"); |
18 | 17 |
|
@@ -41,9 +40,15 @@ pub const DragonflyClient = struct { |
41 | 40 | const addr = std.net.Address.parseIp4(host, port) catch return null; |
42 | 41 | const stream = std.net.tcpConnectToAddress(addr) catch return null; |
43 | 42 |
|
44 | | - // Set a reasonable timeout (5 seconds) |
45 | | - stream.handle.setReadTimeout(5_000_000_000) catch {}; |
46 | | - stream.handle.setWriteTimeout(5_000_000_000) catch {}; |
| 43 | + // Set a reasonable timeout (5 seconds). Failure to set timeouts is |
| 44 | + // non-fatal — operations will block indefinitely on network stalls, |
| 45 | + // but the connection itself is still usable. |
| 46 | + stream.handle.setReadTimeout(5_000_000_000) catch |err| { |
| 47 | + std.log.debug("Dragonfly: failed to set read timeout: {s}", .{@errorName(err)}); |
| 48 | + }; |
| 49 | + stream.handle.setWriteTimeout(5_000_000_000) catch |err| { |
| 50 | + std.log.debug("Dragonfly: failed to set write timeout: {s}", .{@errorName(err)}); |
| 51 | + }; |
47 | 52 |
|
48 | 53 | return .{ |
49 | 54 | .stream = stream, |
|
0 commit comments