Fixing some cosmetic issues and a potential race condition.

This commit is contained in:
Renan DelValle 2020-05-26 19:55:33 -07:00
parent 59533338ef
commit 9f35981f03
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
3 changed files with 6 additions and 5 deletions

View file

@ -503,11 +503,12 @@ func basicAuth(username, password string) string {
func (r *realisClient) ReestablishConn() error {
// Close existing connection
r.logger.Println("Re-establishing Connection to Aurora")
r.Close()
r.lock.Lock()
defer r.lock.Unlock()
r.Close()
// Recreate connection from scratch using original options
newRealis, err := NewRealisClient(r.config.options...)
if err != nil {