fix: test wdpost here

This commit is contained in:
Andrew Jackson (Ajax) 2023-12-02 16:32:13 -06:00
parent e2a15fe353
commit 743bc81aea

View File

@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"database/sql"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
@ -104,19 +105,19 @@ var wdPostTaskCmd = &cli.Command{
return xerrors.Errorf("writing SQL transaction: %w", err) return xerrors.Errorf("writing SQL transaction: %w", err)
} }
fmt.Printf("Inserted task %v. Waiting for success ", id) fmt.Printf("Inserted task %v. Waiting for success ", id)
var result string var result sql.NullString
for { for {
time.Sleep(time.Second) time.Sleep(time.Second)
err = deps.db.QueryRow(ctx, `SELECT result FROM harmony_test WHERE task_id=$1`, id).Scan(&result) err = deps.db.QueryRow(ctx, `SELECT result FROM harmony_test WHERE task_id=$1`, id).Scan(&result)
if err != nil { if err != nil {
return xerrors.Errorf("reading result from harmony_test: %w", err) return xerrors.Errorf("reading result from harmony_test: %w", err)
} }
if result != "" { if result.Valid {
break break
} }
fmt.Print(".") fmt.Print(".")
} }
log.Infof("Result:", result) log.Infof("Result:", result.String)
return nil return nil
}, },
} }