Skip to content

Commit

Permalink
feat: add config param for batch router for name customize (#3461)
Browse files Browse the repository at this point in the history
  • Loading branch information
peakle authored Jun 12, 2023
1 parent 6eea667 commit c16e692
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion router/batchrouter/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ type Handle struct {
warehouseServiceMaxRetryTime time.Duration
transformerURL string
datePrefixOverride string
customDatePrefix string

// state

Expand Down Expand Up @@ -407,7 +408,7 @@ func (brt *Handle) upload(provider string, batchJobs *BatchedJobs, isWarehouse b
default:
datePrefixLayout = time.Now().Format("2006-01-02")
}
keyPrefixes := []string{folderName, batchJobs.Connection.Source.ID, datePrefixLayout}
keyPrefixes := []string{folderName, batchJobs.Connection.Source.ID, brt.customDatePrefix + datePrefixLayout}

_, fileName := filepath.Split(gzipFilePath)
var (
Expand Down
1 change: 1 addition & 0 deletions router/batchrouter/handle_lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ func (brt *Handle) Setup(
config.RegisterDurationConfigVariable(3, &brt.warehouseServiceMaxRetryTime, true, time.Hour, []string{"BatchRouter.warehouseServiceMaxRetryTime", "BatchRouter.warehouseServiceMaxRetryTimeinHr"}...)
brt.transformerURL = config.GetString("DEST_TRANSFORM_URL", "http://localhost:9090")
config.RegisterStringConfigVariable("", &brt.datePrefixOverride, true, "BatchRouter.datePrefixOverride")
config.RegisterStringConfigVariable("", &brt.customDatePrefix, true, "BatchRouter.customDatePrefix")

ctx, cancel := context.WithCancel(context.Background())
brt.backgroundGroup, brt.backgroundCtx = errgroup.WithContext(ctx)
Expand Down

0 comments on commit c16e692

Please sign in to comment.