From 00e2c52663826ab19e15789472f1e8d1299e971b Mon Sep 17 00:00:00 2001 From: Yannic Staudt Date: Thu, 29 Feb 2024 15:12:46 +0100 Subject: [PATCH] :wrench: fixed large refs query bug (again, now github returns a 504 instead of 502 it was some time ago) + added a bit more logging to branches query for failure analysis --- gh/branches.hxx | 2 +- gh/refs.hxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gh/branches.hxx b/gh/branches.hxx index 31895822..0b57ac4b 100644 --- a/gh/branches.hxx +++ b/gh/branches.hxx @@ -97,7 +97,7 @@ namespace gh { result_handler({all_branches.begin(), all_branches.end()}); } } else { - throw std::runtime_error(resp.url + " failed with error: " + std::string(resp.error)); + throw std::runtime_error(resp.url + " failed with error: " + std::string(resp.error) + " - " + resp.text); } }; diff --git a/gh/refs.hxx b/gh/refs.hxx index dbfa772b..5f59565e 100644 --- a/gh/refs.hxx +++ b/gh/refs.hxx @@ -93,7 +93,7 @@ namespace gh { auto response_handler = [&](auto&& resp) { // sometimes, on very large repositories like GRPC, github.com seems to struggle, // but it's able to respond the query in two slices by looking up refs and then heads separately - if(resp.status_code == 502 && filter == filter_refs::ALL) { + if((resp.status_code == 502 || resp.status_code == 504) && filter == filter_refs::ALL) { git_data::refs manual_aggregation{}; @@ -113,7 +113,7 @@ namespace gh { result_handler(pre::json::from_json(resp.text)); } else { throw std::runtime_error( "err : "s + std::string(resp.error) + "status: "s - + std::to_string(resp.status_code) + " accessing : "s + url ); + + std::to_string(resp.status_code) + " accessing : "s + url + " --- " + resp.text); } };