diff --git a/src/gossip/crds_table.zig b/src/gossip/crds_table.zig index 62f734748..8638af861 100644 --- a/src/gossip/crds_table.zig +++ b/src/gossip/crds_table.zig @@ -642,7 +642,7 @@ pub const CrdsTable = struct { } // run this loop in parallel - for (self.pubkey_to_values.keys()[0..n_pubkeys], 0..n_pubkeys) |key, i| { + for (self.pubkey_to_values.keys()[0..n_pubkeys], 0..) |key, i| { var old_labels = std.ArrayList(CrdsValueLabel).init(self.allocator); tasks[i] = GetOldLabelsTask{ .key = key, diff --git a/src/gossip/gossip_service.zig b/src/gossip/gossip_service.zig index 34bcff703..d2b8a9722 100644 --- a/src/gossip/gossip_service.zig +++ b/src/gossip/gossip_service.zig @@ -1116,8 +1116,7 @@ pub const GossipService = struct { var output_limit = std.atomic.Atomic(i64).init(MAX_NUM_CRDS_VALUES_PULL_RESPONSE); - var task_index: usize = 0; - for (valid_indexs.items) |i| { + for (valid_indexs.items, 0..) |i, task_index| { // create the thread task tasks[task_index] = PullRequestTask{ .task = .{ .callback = PullRequestTask.callback }, @@ -1130,7 +1129,6 @@ pub const GossipService = struct { .allocator = self.allocator, .output_limit = &output_limit, }; - task_index += 1; // run it const batch = Batch.from(&tasks[task_index].task);