From dcbb5cb45bbb51f50a752043de8d1d3fbc0ae9b0 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Mon, 2 Feb 2026 17:58:25 +0300 Subject: [PATCH] api: Streamify view_build_statuses handler Similarly to previous patch, the handler can stream the map of build statuses. Unlike previous patch, it doesn't need to fmt::format() key and value, as these are strings already. It could be a map_to_json partial specialization, but there's so far only one caller, so probably not worth it yet. Signed-off-by: Pavel Emelyanov --- api/storage_service.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/api/storage_service.cc b/api/storage_service.cc index 8934bad71d..8947a3f965 100644 --- a/api/storage_service.cc +++ b/api/storage_service.cc @@ -530,9 +530,12 @@ void set_view_builder(http_context& ctx, routes& r, sharded req) -> future { auto keyspace = validate_keyspace(ctx, req); auto view = req->get_path_param("view"); - auto status = co_await vb.local().view_build_statuses(std::move(keyspace), std::move(view), g.local()); - std::vector res; - co_return json::json_return_type(map_to_key_value(std::move(status), res)); + co_return json::json_return_type(stream_range_as_array(co_await vb.local().view_build_statuses(std::move(keyspace), std::move(view), g.local()), [] (const auto& i) { + storage_service_json::mapper res; + res.key = i.first; + res.value = i.second; + return res; + })); }); cf::get_built_indexes.set(r, [&vb](std::unique_ptr req) -> future {