Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions builder/git/gitserver/gitaly/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ type Client struct {
smartHttpClient gitalypb.SmartHTTPServiceClient
remoteClient gitalypb.RemoteServiceClient
timeout time.Duration
treeTimeout time.Duration
repoStore database.RepoStore
}

Expand Down Expand Up @@ -91,6 +92,7 @@ func NewClient(config *config.Config) (*Client, error) {
}

timeoutTime := time.Duration(config.Git.OperationTimeout) * time.Second
treeTimeoutTime := time.Duration(config.Git.TreeOperationTimeout) * time.Second
return &Client{
config: config,
sidechannelRegistry: sidechannelRegistry,
Expand All @@ -104,5 +106,6 @@ func NewClient(config *config.Config) (*Client, error) {
remoteClient: remoteClient,
timeout: timeoutTime,
repoStore: database.NewRepoStore(),
treeTimeout: treeTimeoutTime,
}, nil
}
10 changes: 5 additions & 5 deletions builder/git/gitserver/gitaly/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ func (c *Client) getBlobInfo(ctx context.Context, repo *gitalypb.Repository, pat

func (c *Client) GetRepoFileTree(ctx context.Context, req gitserver.GetRepoInfoByPathReq) ([]*types.File, error) {
var files []*types.File
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
ctx, cancel := context.WithTimeout(ctx, c.treeTimeout)
defer cancel()

req.Path = strings.TrimPrefix(req.Path, "/")
Expand Down Expand Up @@ -757,7 +757,7 @@ func (c *Client) GetRepoFileTree(ctx context.Context, req gitserver.GetRepoInfoB
}

func (c *Client) GetTree(ctx context.Context, req types.GetTreeRequest) (*types.GetRepoFileTreeResp, error) {
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
ctx, cancel := context.WithTimeout(ctx, c.treeTimeout)
defer cancel()

req.Path = strings.TrimPrefix(req.Path, "/")
Expand Down Expand Up @@ -842,7 +842,7 @@ func (c *Client) GetTree(ctx context.Context, req types.GetTreeRequest) (*types.

func (c *Client) GetLogsTree(ctx context.Context, req types.GetLogsTreeRequest) (*types.LogsTreeResp, error) {
var resp []*types.CommitForTree
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
ctx, cancel := context.WithTimeout(ctx, c.treeTimeout)
defer cancel()

req.Path = strings.TrimPrefix(req.Path, "/")
Expand Down Expand Up @@ -912,7 +912,7 @@ func (c *Client) GetLogsTree(ctx context.Context, req types.GetLogsTreeRequest)

func (c *Client) GetRepoAllFiles(ctx context.Context, req gitserver.GetRepoAllFilesReq) ([]*types.File, error) {
var files []*types.File
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
ctx, cancel := context.WithTimeout(ctx, c.treeTimeout)
defer cancel()

relativePath, err := c.BuildRelativePath(ctx, req.RepoType, req.Namespace, req.Name)
Expand Down Expand Up @@ -955,7 +955,7 @@ func (c *Client) GetRepoAllFiles(ctx context.Context, req gitserver.GetRepoAllFi

func (c *Client) GetRepoAllLfsPointers(ctx context.Context, req gitserver.GetRepoAllFilesReq) ([]*types.LFSPointer, error) {
var pointers []*types.LFSPointer
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
ctx, cancel := context.WithTimeout(ctx, c.treeTimeout)
defer cancel()

relativePath, err := c.BuildRelativePath(ctx, req.RepoType, req.Namespace, req.Name)
Expand Down
1 change: 1 addition & 0 deletions common/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ type Config struct {
LfsExistsCheck bool `env:"STARHUB_SERVER_GIT_LFS_EXISTS_CHECK" default:"true"`
RepoDataMigrateEnable bool `env:"STARHUB_SERVER_GIT_REPO_DATA_MIGRATE_ENABLE" default:"false"`
LimitLfsFileUploadSize bool `env:"STARHUB_SERVER_GIT_LIMIT_LFS_FILE_UPLOAD_SIZE " default:"true"`
TreeOperationTimeout int `env:"STARHUB_SERVER_GIT_TREE_OPERATION_TIMEOUT" default:"3"`
}

AIGateway struct {
Expand Down
Loading