Skip to content

Instantly share code, notes, and snippets.

@mlauter
Last active May 6, 2019 22:02
Show Gist options
  • Save mlauter/38fa48dd875954be28c657eba0f866c7 to your computer and use it in GitHub Desktop.
Save mlauter/38fa48dd875954be28c657eba0f866c7 to your computer and use it in GitHub Desktop.
shard executor actually consume the queries?
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