Skip to content

Commit 6e98c0e

Browse files
authored
fix(component,artifact): remove duplicated connection close (#1001)
Because - connection is close before execution completed. This commit - remove duplicated connection close.
1 parent 470a19d commit 6e98c0e

8 files changed

+8
-23
lines changed

pkg/component/data/instillartifact/v0/task_get_chunks_metadata.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ func (e *execution) getChunksMetadata(input *structpb.Struct) (*structpb.Struct,
2121
return nil, fmt.Errorf("failed to convert input to struct: %w", err)
2222
}
2323

24-
artifactClient, connection := e.client, e.connection
25-
26-
defer connection.Close()
24+
artifactClient := e.client
2725

2826
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
2927
defer cancel()

pkg/component/data/instillartifact/v0/task_get_file_in_markdown.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ func (e *execution) getFileInMarkdown(input *structpb.Struct) (*structpb.Struct,
2121
return nil, fmt.Errorf("failed to convert input to struct: %w", err)
2222
}
2323

24-
artifactClient, connection := e.client, e.connection
25-
26-
defer connection.Close()
24+
artifactClient := e.client
2725

2826
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
2927
defer cancel()

pkg/component/data/instillartifact/v0/task_get_files_metadata.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ func (e *execution) getFilesMetadata(input *structpb.Struct) (*structpb.Struct,
2222
return nil, fmt.Errorf("failed to convert input to struct: %w", err)
2323
}
2424

25-
artifactClient, connection := e.client, e.connection
26-
27-
defer connection.Close()
25+
artifactClient := e.client
2826

2927
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
3028
defer cancel()

pkg/component/data/instillartifact/v0/task_match_files_status.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ func (e *execution) matchFileStatus(input *structpb.Struct) (*structpb.Struct, e
2121
return nil, fmt.Errorf("failed to convert input to struct: %w", err)
2222
}
2323

24-
artifactClient, connection := e.client, e.connection
25-
26-
defer connection.Close()
24+
artifactClient := e.client
2725

2826
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
2927
defer cancel()

pkg/component/data/instillartifact/v0/task_query.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ func (e *execution) query(input *structpb.Struct) (*structpb.Struct, error) {
2121
return nil, fmt.Errorf("failed to convert input to struct: %w", err)
2222
}
2323

24-
artifactClient, connection := e.client, e.connection
25-
26-
defer connection.Close()
24+
artifactClient := e.client
2725

2826
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
2927
defer cancel()

pkg/component/data/instillartifact/v0/task_search_chunks.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ func (e *execution) searchChunks(input *structpb.Struct) (*structpb.Struct, erro
2121
return nil, fmt.Errorf("failed to convert input to struct: %w", err)
2222
}
2323

24-
artifactClient, connection := e.client, e.connection
25-
26-
defer connection.Close()
24+
artifactClient := e.client
2725

2826
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
2927
defer cancel()

pkg/component/data/instillartifact/v0/task_sync_files.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ func (e *execution) syncFiles(input *structpb.Struct) (*structpb.Struct, error)
5353
return nil, fmt.Errorf("convert input to struct: %w", err)
5454
}
5555

56-
artifactClient, connection := e.client, e.connection
57-
58-
defer connection.Close()
56+
artifactClient := e.client
5957

6058
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
6159
defer cancel()

pkg/component/data/instillartifact/v0/task_upload_files.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ func (e *execution) uploadFiles(input *structpb.Struct) (*structpb.Struct, error
2929
return nil, fmt.Errorf("number of files and file names do not match")
3030
}
3131

32-
artifactClient, connection := e.client, e.connection
33-
defer connection.Close()
32+
artifactClient := e.client
3433

3534
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
3635
defer cancel()

0 commit comments

Comments
 (0)