Skip to content

Commit 45f4892

Browse files
committed
feat: set request timeout
1 parent ba139dd commit 45f4892

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/github_client/github_client.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ func GetRemainingLimits(c *github.Client) (RateLimits, error) {
2020
return RateLimits{}, utils.RespError(fmt.Errorf("github client is nil"))
2121
}
2222

23-
ctx := context.Background()
23+
// Set a timeout of 5 seconds for the request
24+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
25+
defer cancel()
2426

2527
limits, _, err := c.RateLimit.Get(ctx)
2628
if err != nil {

0 commit comments

Comments
 (0)