Fixing some cosmetic issues and a potential race condition.

This commit is contained in:
Renan DelValle 2020-05-26 19:55:33 -07:00 committed by Renán I. Del Valle
parent bb5408f5e2
commit f196aa9ed7
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 {