Skip to content

Commit

Permalink
fix defer res.Close() in other places
Browse files Browse the repository at this point in the history
  • Loading branch information
k-anshul committed Dec 15, 2023
1 parent 9086c99 commit 05e8dd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions runtime/drivers/duckdb/transporter_duckDB_to_duckDB.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ func (t *duckDBToDuckDB) transferFromExternalDB(ctx context.Context, srcProps *d
var localDB, localSchema string
for res.Next() {
if err := res.Scan(&localDB, &localSchema); err != nil {
res.Close()
_ = res.Close()
return err
}
}
res.Close()
_ = res.Close()

// duckdb considers everything before first . as db name
// alternative solution can be to query `show databases()` before and after to identify db name
Expand Down
10 changes: 6 additions & 4 deletions runtime/drivers/duckdb/transporter_motherduck_to_duckDB.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ func (t *motherduckToDuckDB) Transfer(ctx context.Context, srcProps, sinkProps m
if err != nil {
return err
}
defer res.Close()

res.Next()
var localDB, localSchema string
if err := res.Scan(&localDB, &localSchema); err != nil {
return err
for res.Next() {
if err := res.Scan(&localDB, &localSchema); err != nil {
_ = res.Close()
return err
}
}
_ = res.Close()

// get token
token, _ := config["token"].(string)
Expand Down

0 comments on commit 05e8dd7

Please sign in to comment.