good morning!!!!

Skip to content
Snippets Groups Projects
Commit 0b13e3e2 authored by Garet Halliday's avatar Garet Halliday
Browse files

some debug prints

parent f9d012be
No related branches found
No related tags found
No related merge requests found
......@@ -134,7 +134,7 @@ func (T *Config) ListenAndServe() error {
addr = net.JoinHostPort(cluster.Connection.Host, strconv.Itoa(cluster.Connection.Port))
}
p.AddRecipe("do", recipe.NewRecipe(recipe.Options{
p.AddRecipe(cluster.Name, recipe.NewRecipe(recipe.Options{
Dialer: dialer.Net{
Network: "tcp",
Address: addr,
......@@ -163,7 +163,7 @@ func (T *Config) ListenAndServe() error {
replicaAddr = net.JoinHostPort(replica.Connection.Host, strconv.Itoa(replica.Connection.Port))
}
p2.AddRecipe("do", recipe.NewRecipe(recipe.Options{
p2.AddRecipe(replica.Name, recipe.NewRecipe(recipe.Options{
Dialer: dialer.Net{
Network: "tcp",
Address: replicaAddr,
......@@ -172,8 +172,8 @@ func (T *Config) ListenAndServe() error {
}))
}
pools.Add(user.Name+"_ro", dbname, p2)
log.Printf("registered database user=%s database=%s", user.Name+"_ro", dbname)
pools.Add(creds2.Username, dbname, p2)
log.Printf("registered database user=%s database=%s", creds2.Username, dbname)
}
}
}
......
......@@ -147,6 +147,9 @@ func (T *Pool) removeRecipe(name string) {
}
func (T *Pool) scaleUp() {
log.Printf("scaling up")
defer log.Printf("finished scaling up")
backoff := T.options.ServerReconnectInitialTime
backingOff := false
......@@ -206,6 +209,8 @@ func (T *Pool) scaleUp() {
backingOff = true
}
log.Printf("failed to dial server. trying again in %v", backoff)
time.Sleep(backoff)
backoff *= 2
......@@ -356,7 +361,7 @@ func (T *Pool) ServeBot(
return T.serve(client, true)
}
func (T *Pool) serve(client *Client, initialize bool) error {
func (T *Pool) serve(client *Client, initialized bool) error {
T.addClient(client)
defer T.removeClient(client)
......@@ -375,7 +380,7 @@ func (T *Pool) serve(client *Client, initialize bool) error {
}
}()
if !initialize {
if !initialized {
server = T.acquireServer(client)
err, serverErr = Pair(T.options, client, server)
......@@ -396,7 +401,7 @@ func (T *Pool) serve(client *Client, initialize bool) error {
for {
if server != nil && T.options.ReleaseAfterTransaction {
client.SetState(metrics.ConnStateIdle, uuid.Nil)
T.releaseServer(server) // TODO(garet) does this need to be a goroutine
T.releaseServer(server)
server = nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment