Skip to content

Commit

Permalink
backloader bug fix (#132)
Browse files Browse the repository at this point in the history
* fixed flags for at from and to

* fixed map sorting for query build
  • Loading branch information
zJeremiah authored Sep 9, 2020
1 parent 1ff9a0d commit eef35a8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions apps/taskmasters/backloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,9 @@ func run() error {
flag.StringVar(&f.bus, "bus", "stdout", "one of 'stdout', 'file', 'nsq', 'pubsub'")
flag.StringVar(&f.bus, "b", "", "alias of 'bus'")

var at, from, to string
flag.StringVar(&at, "at", "", "run once for a specific time. format 'yyyy-mm-ddThh' (example: '2017-01-03T01')")
flag.StringVar(&from, "from", "now", "format 'yyyy-mm-ddThh' (example: '2017-01-03T01'). Allows a special keyword 'now'.")
flag.StringVar(&to, "to", "", "same format as 'from'; if not specified, will run the one hour specified by from. Allows special keyword 'now'.")
flag.StringVar(&f.at, "at", "", "run once for a specific time. format 'yyyy-mm-ddThh' (example: '2017-01-03T01')")
flag.StringVar(&f.from, "from", "now", "format 'yyyy-mm-ddThh' (example: '2017-01-03T01'). Allows a special keyword 'now'.")
flag.StringVar(&f.to, "to", "", "same format as 'from'; if not specified, will run the one hour specified by from. Allows special keyword 'now'.")
flag.BoolVar(&f.daily, "daily", false, "sets hour to 00 and populates every 24 hours")

flag.IntVar(&f.everyXHours, "every-x-hours", 0, "will generate a task every x hours. Includes the first hour. Can be combined with 'on-hours' and 'off-hours' fions.")
Expand Down
3 changes: 2 additions & 1 deletion apps/workers/sql-read/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io/ioutil"
"sort"
"strings"

"github.com/dustin/go-humanize"
Expand Down Expand Up @@ -49,7 +50,7 @@ func (o *options) NewWorker(info string) task.Worker {
for k := range iOpts.Fields {
cols = append(cols, k)
}

sort.Strings(cols) // we must sort the slice as a map is random order (cannot test)
query = fmt.Sprintf("select %s from %s",
strings.Join(cols, ", "), iOpts.Table)
}
Expand Down

0 comments on commit eef35a8

Please sign in to comment.