Skip to content

Commit

Permalink
🔧 fixed large refs query bug (again, now github returns a 504 instead…
Browse files Browse the repository at this point in the history
… of 502 it was some time ago) + added a bit more logging to branches query for failure analysis
  • Loading branch information
pysco68 committed Feb 29, 2024
1 parent 40b6ac9 commit 00e2c52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gh/branches.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
4 changes: 2 additions & 2 deletions gh/refs.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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{};

Expand All @@ -113,7 +113,7 @@ namespace gh {
result_handler(pre::json::from_json<git_data::refs>(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);
}
};

Expand Down

0 comments on commit 00e2c52

Please sign in to comment.