Skip to content

Commit

Permalink
close db when insert finished
Browse files Browse the repository at this point in the history
  • Loading branch information
李毓琪 authored and 李毓琪 committed Sep 19, 2023
1 parent 5a19f6b commit db2b1c2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/telemetryservice/sql/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (db *DBHelper) SendToDB(ctx context.Context, deviceName string, rawData []b
return err
}

return nil
return db.DB.Close()

Check warning on line 44 in pkg/telemetryservice/sql/mysql/mysql.go

View check run for this annotation

Codecov / codecov/patch

pkg/telemetryservice/sql/mysql/mysql.go#L44

Added line #L44 was not covered by tests
}

func constructDBUri(sqlcs *v1alpha1.SQLConnectionSetting) string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/telemetryservice/sql/sqlserver/sqlserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (db *DBHelper) SendToDB(ctx context.Context, deviceName string, rawData []b
return err
}

return nil
return db.DB.Close()

Check warning on line 44 in pkg/telemetryservice/sql/sqlserver/sqlserver.go

View check run for this annotation

Codecov / codecov/patch

pkg/telemetryservice/sql/sqlserver/sqlserver.go#L44

Added line #L44 was not covered by tests
}

func constructDBUri(sqlcs *v1alpha1.SQLConnectionSetting) string {
Expand Down
2 changes: 1 addition & 1 deletion pkg/telemetryservice/sql/tdengine/tdengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (db *DBHelper) SendToDB(ctx context.Context, deviceName string, rawData []b
return err
}

return nil
return db.DB.Close()

Check warning on line 37 in pkg/telemetryservice/sql/tdengine/tdengine.go

View check run for this annotation

Codecov / codecov/patch

pkg/telemetryservice/sql/tdengine/tdengine.go#L37

Added line #L37 was not covered by tests
}

func (db *DBHelper) ConnectToDB(ctx context.Context) error {
Expand Down

0 comments on commit db2b1c2

Please sign in to comment.