diff --git a/src/slurper.zig b/src/slurper.zig index b1ba1a0..52d47c6 100644 --- a/src/slurper.zig +++ b/src/slurper.zig @@ -24,7 +24,6 @@ const log = std.log.scoped(.relay); pub const Options = struct { seed_host: []const u8 = "bsky.network", max_message_size: usize = 5 * 1024 * 1024, - new_hosts_per_day: u32 = 50, // Go relay: RELAY_NEW_HOSTS_PER_DAY_LIMIT default 50 }; // --- host validation --- @@ -217,10 +216,6 @@ pub const Slurper = struct { // crawl processing thread crawl_thread: ?std.Thread = null, - // per-day new host rate limit (Go relay: HostPerDayLimiter) - hosts_added_today: u32 = 0, - rate_limit_day_start: i64 = 0, - pub fn init( allocator: Allocator, bc: *broadcaster.Broadcaster, @@ -411,14 +406,7 @@ pub const Slurper = struct { } } - // step 5: per-day rate limit for new hosts - // Go relay: HostPerDayLimiter (sliding window, 50/day default) - if (!self.checkHostRateLimit()) { - log.warn("host {s}: new-hosts-per-day limit reached ({d}), rejecting", .{ hostname, self.options.new_hosts_per_day }); - return; - } - - // step 6: describeServer liveness check + // step 5: describeServer liveness check // Go relay: host_checker.go CheckHost (with SSRF protection) checkHost(self.allocator, hostname) catch |err| { log.warn("host {s}: describeServer check failed: {s}", .{ hostname, @errorName(err) }); @@ -429,20 +417,6 @@ pub const Slurper = struct { log.info("added host {s} (id={d})", .{ hostname, host_info.id }); } - /// check and consume one token from the daily host rate limit. - /// resets counter when a new UTC day starts. - fn checkHostRateLimit(self: *Slurper) bool { - const now = std.time.timestamp(); - const day_seconds: i64 = 86400; - if (now - self.rate_limit_day_start >= day_seconds) { - self.hosts_added_today = 0; - self.rate_limit_day_start = now; - } - if (self.hosts_added_today >= self.options.new_hosts_per_day) return false; - self.hosts_added_today += 1; - return true; - } - /// spawn a subscriber thread for a host fn spawnWorker(self: *Slurper, host_id: u64, hostname: []const u8) !void { const hostname_duped = try self.allocator.dupe(u8, hostname);