Restoring location of r.Close() in retry mechanism since the move created a deadlock. (#122)
Moving the r.Close() call in the retry mechanism created a deadlock since r.Close() also uses the client lock to avoid multiple routines closing at the same time. This commit reverts that change.
This commit is contained in:
parent
f196aa9ed7
commit
5ec22fab98
1 changed files with 5 additions and 2 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue