Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logs to client.execute for debug purposes #105

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Changelog

## v0.5.14-alpha
* Added print outs for client.execute.

## v0.5.13-alpha
* Fix (u)int128/hash handling.

## v0.5.12-alpha
* Add beta version of snowflake datastream APIs.
* Add beta version of snowflake datastream APIs.

## v0.5.11-alpha
* Add ability to start and stop engines.
* Add ability to start and stop engines.

## v0.5.10-alpha
* `X-Request-Id` is generated for every HTTP request.
Expand Down
8 changes: 7 additions & 1 deletion rai/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"mime"
"mime/multipart"
"net/http"
Expand Down Expand Up @@ -974,6 +975,7 @@ func (c *Client) Execute(
return nil, err
}
if isTransactionComplete(&rsp.Transaction) {
log.Printf("Txn state: %s.\n", rsp.Transaction.State)
return rsp, nil // fast path
}
id := rsp.Transaction.ID
Expand All @@ -985,13 +987,17 @@ func (c *Client) Execute(
return nil, err
}
if isTransactionComplete(&rsp.Transaction) {
log.Printf("Txn %s state: %s.", id, rsp.Transaction.State)
return rsp, nil
}
delta := time.Since(t0) // total run time
log.Printf("Txn %s state: %s.", id, rsp.Transaction.State)
delta := time.Since(t0) // total run time
log.Printf("Delta is %s.", delta)
pause := time.Duration(int64(delta) / 5) // 20% of total run time
if pause > twoMinutes {
pause = twoMinutes
}
log.Printf("Pause took %s.", pause)
time.Sleep(pause)
}
}
Expand Down
2 changes: 1 addition & 1 deletion rai/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

package rai

const Version = "0.5.12-alpha"
const Version = "0.5.14-alpha"
Loading