Last active
May 6, 2019 22:02
-
-
Save mlauter/38fa48dd875954be28c657eba0f866c7 to your computer and use it in GitHub Desktop.
shard executor actually consume the queries?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tool/shard_executor/main.go b/tool/shard_executor/main.go | |
index bfb0e01..95bd568 100644 | |
--- a/tool/shard_executor/main.go | |
+++ b/tool/shard_executor/main.go | |
@@ -111,9 +111,17 @@ func consume(msgs <-chan string, done chan<- bool) { | |
queryType := getQueryType(msg) | |
start := time.Now() | |
- _, err := db.Exec(msg) | |
+ rows, err := db.Query(msg) | |
+ defer rows.Close() | |
t := time.Now().Sub(start) | |
+ var id int | |
+ var val string | |
+ for rows.Next() { | |
+ _ := rows.Scan(&id, &val) | |
+ fmt.Println("%d %s", id, val) | |
+ } | |
+ | |
statsClient.TimingDuration(fmt.Sprintf("latency.%s", queryType), t) | |
statsClient.TimingDuration("latency.all", t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment