Skip to content

Commit

Permalink
add --redis flag (#52)
Browse files Browse the repository at this point in the history
add --redis flag
  • Loading branch information
ababino authored Sep 11, 2024
1 parent 53a6055 commit d9fd104
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/service/bidcollect.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ var bidCollectCmd = &cobra.Command{
OutDir: outDir,
OutputTSV: outputTSV,
RedisAddr: redisAddr,
UseRedis: useRedis,
}

bidCollector, err := bidcollect.NewBidCollector(&opts)
Expand Down
3 changes: 2 additions & 1 deletion services/bidcollect/bid-processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type BidProcessorOpts struct {
OutDir string
OutputTSV bool
RedisAddr string
UseRedis bool
}

type OutFiles struct {
Expand Down Expand Up @@ -68,7 +69,7 @@ func NewBidProcessor(opts *BidProcessorOpts) (*BidProcessor, error) {
c.csvFileEnding = "csv"
}

if opts.RedisAddr != "" {
if opts.UseRedis && opts.RedisAddr != "" {
c.redisClient = redis.NewClient(&redis.Options{
Addr: opts.RedisAddr,
Password: "", // no password set
Expand Down
2 changes: 2 additions & 0 deletions services/bidcollect/bidcollector.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type BidCollectorOpts struct {
OutputTSV bool

RedisAddr string
UseRedis bool
}

type BidCollector struct {
Expand Down Expand Up @@ -57,6 +58,7 @@ func NewBidCollector(opts *BidCollectorOpts) (c *BidCollector, err error) {
OutDir: opts.OutDir,
OutputTSV: opts.OutputTSV,
RedisAddr: opts.RedisAddr,
UseRedis: opts.UseRedis,
})
return c, err
}
Expand Down

0 comments on commit d9fd104

Please sign in to comment.