Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
chore: add a constant
Browse files Browse the repository at this point in the history
  • Loading branch information
lavkesh committed Sep 12, 2023
1 parent 2589ee1 commit a9fc7cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/server/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"google.golang.org/api/option"
)

const clientTimeout = time.Second * 120

func NewClient(keyFilePath string) (*Client, error) {
client, err := storage.NewClient(context.Background(), option.WithCredentialsFile(keyFilePath))
if err != nil {
Expand All @@ -35,7 +37,7 @@ func (client Client) ListTopicDates(bucketInfo BucketInfo) (map[string]map[strin
ctx := context.Background()
// map(topic -> map(Date -> size))
topicDateMap := make(map[string]map[string]int64)
ctx, cancel := context.WithTimeout(ctx, time.Second*120)
ctx, cancel := context.WithTimeout(ctx, clientTimeout)
defer cancel()
it := client.storageClient.Objects(ctx, bucket, &storage.Query{
Prefix: prefix,
Expand Down

0 comments on commit a9fc7cd

Please sign in to comment.