You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2018/08/13 17:35:08 UTC
[GitHub] rawlinp opened a new issue #2666: TO Golang: api.NewInfo Close()
deferral postpones DB transaction commit until after API response is written
rawlinp opened a new issue #2666: TO Golang: api.NewInfo Close() deferral postpones DB transaction commit until after API response is written
URL: https://github.com/apache/trafficcontrol/issues/2666
General usage of `api.NewInfo()` [1] is that the `APIInfo.Close()` method is immediately deferred in the request handler that uses it (example: [2]). This keeps the DB transaction from committing until _after_ the handler writes the API response. Since a DB transaction uses limited shared resources, it should be closed as soon as possible after the required DB operation in order to return the used DB connection back to the pool for other request handlers to use.
Performance testing may be needed in order to prioritize this based upon performance impact. A good place to start would be with shared_handlers.go which would affect all the CRUD handlers.
[1] https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/api/api.go#L268
[2] https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/api/shared_handlers.go#L130
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services