Skip to content

Commit bed7a75

Browse files
committed
Fixed timeout issues
1 parent a78e361 commit bed7a75

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

action.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,23 @@ runs:
8989
# Make the API call with extended timeouts for long-running requests
9090
# --max-time: Maximum time for the entire operation (30 minutes)
9191
# --connect-timeout: Maximum time for connection establishment (60 seconds)
92-
# --keepalive-time: Send keepalive probes every 60 seconds
93-
# --tcp-keepalive: Enable TCP keepalive
92+
# --keepalive-time: Send keepalive probes every 60 seconds (if supported)
93+
# --no-buffer: Disable output buffering to show progress
9494
response=$(curl -s -w "%{http_code}" -o "$TEMP_FILE" \
9595
--max-time 1800 \
9696
--connect-timeout 60 \
9797
--keepalive-time 60 \
98-
--tcp-keepalive \
98+
--no-buffer \
9999
"$ENDPOINT_URL?url=$REPO_URL&source_branch=$SOURCE_BRANCH&target_branch=$TARGET_BRANCH&output_format=$OUTPUT_FORMAT")
100+
curl_exit_code=$?
100101
http_code=${response: -3}
101102
102103
echo "API response status code: $http_code"
104+
echo "Curl exit code: $curl_exit_code"
103105
104106
# Handle timeout specifically
105-
if [ $? -eq 28 ]; then
106-
echo "Error: Request timed out after 25 minutes"
107+
if [ $curl_exit_code -eq 28 ]; then
108+
echo "Error: Request timed out after 30 minutes"
107109
echo "The repository analysis is taking longer than expected."
108110
echo "This might be due to:"
109111
echo "- Very large repository size"
@@ -114,6 +116,19 @@ runs:
114116
exit 1
115117
fi
116118
119+
# Handle other curl errors
120+
if [ $curl_exit_code -ne 0 ]; then
121+
echo "Error: Curl failed with exit code $curl_exit_code"
122+
case $curl_exit_code in
123+
6) echo "Couldn't resolve host" ;;
124+
7) echo "Failed to connect to host" ;;
125+
56) echo "Failure in receiving network data" ;;
126+
*) echo "Unknown curl error" ;;
127+
esac
128+
rm -f "$TEMP_FILE"
129+
exit 1
130+
fi
131+
117132
if [ "$http_code" = "404" ]; then
118133
echo "No documentation files were generated for this repository/branch combination."
119134
echo "This might be because:"

0 commit comments

Comments
 (0)