|
@@ -62,8 +62,8 @@ func (c App) Json() revel.Result {
|
|
|
}
|
|
|
|
|
|
func (c App) Db(queries int) revel.Result {
|
|
|
- rowNum := rand.Intn(WorldRowCount) + 1
|
|
|
if queries <= 1 {
|
|
|
+ rowNum := rand.Intn(WorldRowCount) + 1
|
|
|
var w World
|
|
|
worldStatement.QueryRow(rowNum).Scan(&w.Id, &w.RandomNumber)
|
|
|
return c.RenderJson(w)
|
|
@@ -74,6 +74,7 @@ func (c App) Db(queries int) revel.Result {
|
|
|
wg.Add(queries)
|
|
|
for i := 0; i < queries; i++ {
|
|
|
go func(i int) {
|
|
|
+ rowNum := rand.Intn(WorldRowCount) + 1
|
|
|
err := worldStatement.QueryRow(rowNum).Scan(&ww[i].Id, &ww[i].RandomNumber)
|
|
|
if err != nil {
|
|
|
revel.ERROR.Fatalf("Error scanning world row: %v", err)
|