diff --git a/examples/client.go b/examples/client.go index f0dcedf..69e3751 100644 --- a/examples/client.go +++ b/examples/client.go @@ -111,7 +111,7 @@ func main() { if err != nil { log.Fatalln(err) } - monitor = &realis.Monitor{r} + monitor = &realis.Monitor{Client: r} defer r.Close() switch executor { diff --git a/realis.go b/realis.go index fe4c5e8..1c7921b 100644 --- a/realis.go +++ b/realis.go @@ -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 { diff --git a/retry.go b/retry.go index 77b02d5..dff5658 100644 --- a/retry.go +++ b/retry.go @@ -137,7 +137,7 @@ func (r *realisClient) thriftCallWithRetries( } r.logger.Printf( - "A retryable error occurred during thrift call, backing off for %v before retry %v\n", + "A retryable error occurred during thrift call, backing off for %v before retry %v", adjusted, curStep) @@ -154,7 +154,7 @@ func (r *realisClient) thriftCallWithRetries( resp, clientErr = thriftCall() - r.logger.tracePrintf("Aurora Thrift Call ended resp: %v clientErr: %v\n", resp, clientErr) + r.logger.tracePrintf("Aurora Thrift Call ended resp: %v clientErr: %v", resp, clientErr) }() // Check if our thrift call is returning an error. This is a retryable event as we don't know @@ -162,7 +162,7 @@ func (r *realisClient) thriftCallWithRetries( if clientErr != nil { // Print out the error to the user - r.logger.Printf("Client Error: %v\n", clientErr) + r.logger.Printf("Client Error: %v", clientErr) // Determine if error is a temporary URL error by going up the stack e, ok := clientErr.(thrift.TTransportException)