Restoring location of r.Close() in retry mechanism since the move created a deadlock.

This commit is contained in:
Renan DelValle 2020-05-27 12:35:08 -07:00
parent f196aa9ed7
commit b644a35e65
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9

View file

@ -504,11 +504,14 @@ func (r *realisClient) ReestablishConn() error {
// Close existing connection
r.logger.Println("Re-establishing Connection to Aurora")
// This call must happen before we lock as it also uses
// the same lock from the client since close can be called
// by anyone from anywhere.
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 {