atproto relay implementation in zig zlay.waow.tech

fix: periodically recreate DID resolver to free http.Client state

The resolver threads kept a single http.Client for the process lifetime,
accumulating connection/TLS state across millions of DID resolutions.
Recreate the resolver every 1000 resolutions to shed that state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+8
+8
src/validator.zig
··· 397 397 fn resolveLoop(self: *Validator) void { 398 398 var resolver = zat.DidResolver.init(self.allocator); 399 399 defer resolver.deinit(); 400 + var resolve_count: u32 = 0; 400 401 401 402 while (self.alive.load(.acquire)) { 402 403 var did: ?[]const u8 = null; ··· 422 423 self.cache_mutex.lock(); 423 424 defer self.cache_mutex.unlock(); 424 425 if (self.cache.contains(d)) continue; 426 + } 427 + 428 + // periodically recreate resolver to free accumulated http.Client state 429 + resolve_count += 1; 430 + if (resolve_count % 1000 == 0) { 431 + resolver.deinit(); 432 + resolver = zat.DidResolver.init(self.allocator); 425 433 } 426 434 427 435 // resolve DID → signing key