Skip to content

Commit

Permalink
fix passing ctx through.
Browse files Browse the repository at this point in the history
  • Loading branch information
preslavgerchev committed Dec 7, 2023
1 parent 97cb46d commit e5ecea4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions policy/bundle_s3_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (l *s3Resolver) Load(ctx context.Context, path string) (*Bundle, error) {

trimmed := strings.TrimPrefix(path, "s3://")
if ok, bucket, key := isS3Key(trimmed); ok {
return fetchBundleFromS3(s3Client, bucket, key)
return fetchBundleFromS3(ctx, s3Client, bucket, key)
}

// else we're looking at a bucket so we need to iterate over all the files inside
Expand All @@ -41,7 +41,7 @@ func (l *s3Resolver) Load(ctx context.Context, path string) (*Bundle, error) {
}
}
for _, file := range resolvedNames {
bundle, err := fetchBundleFromS3(s3Client, trimmed, file)
bundle, err := fetchBundleFromS3(ctx, s3Client, trimmed, file)
if err != nil {
return nil, err
}
Expand All @@ -64,8 +64,8 @@ func isS3Key(path string) (bool, string, string) {
return false, "", ""
}

func fetchBundleFromS3(client *s3.Client, bucket string, key string) (*Bundle, error) {
resp, err := client.GetObject(context.Background(), &s3.GetObjectInput{Bucket: &bucket, Key: &key})
func fetchBundleFromS3(ctx context.Context, client *s3.Client, bucket string, key string) (*Bundle, error) {
resp, err := client.GetObject(ctx, &s3.GetObjectInput{Bucket: &bucket, Key: &key})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit e5ecea4

Please sign in to comment.