rob05c commented on a change in pull request #1804: prepared transactions from
within a handler create a connections leak to postgres
URL:
https://github.com/apache/incubator-trafficcontrol/pull/1804#discussion_r165403985
##########
File path: traffic_ops/traffic_ops_golang/tenant/tenancy.go
##########
@@ -45,13 +45,9 @@ func (dsInfo DeliveryServiceTenantInfo)
IsTenantAuthorized(user auth.CurrentUser
// returns tenant information for a deliveryservice
func GetDeliveryServiceTenantInfo(xmlId string, db *sqlx.DB)
(*DeliveryServiceTenantInfo, error) {
ds := DeliveryServiceTenantInfo{}
- tenantInfoStmt, err := db.Preparex("SELECT xml_id,tenant_id FROM
deliveryservice where xml_id = $1")
- if err != nil {
- log.Errorf("deliveryservice sql query error, xmlId '%s': %v\n",
xmlId, err)
- return nil, err
- }
+ query := "SELECT xml_id,tenant_id FROM deliveryservice where xml_id =
$1"
- err = tenantInfoStmt.Get(&ds, xmlId)
+ err := db.Get(&ds,query,xmlId)
Review comment:
I think `xmlID` is preferable. Acronyms should be consistent case, but all
lower is acceptable, and local variables (which are unexported) should start
with lower case, per
https://github.com/golang/go/wiki/CodeReviewComments#initialisms
https://github.com/golang/go/wiki/CodeReviewComments#mixed-caps
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services