Skip to content

Commit

Permalink
fixup! review
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidddddarth committed Dec 5, 2023
1 parent 2d51abb commit f06fc0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions warehouse/integrations/clickhouse/clickhouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ func New(conf *config.Config, log logger.Logger, stat stats.Stats) *Clickhouse {
ch.config.s3EngineEnabledWorkspaceIDs = conf.GetStringSlice("Warehouse.clickhouse.s3EngineEnabledWorkspaceIDs", nil)
ch.config.slowQueryThreshold = conf.GetDuration("Warehouse.clickhouse.slowQueryThreshold", 5, time.Minute)
r := rand.New(rand.NewSource(time.Now().UnixNano()))
ch.config.randomLoadDelay = func(destinationID string) time.Duration {
ch.config.randomLoadDelay = func(workspaceID string) time.Duration {
maxDelay := conf.GetDurationVar(
0,
time.Second,
fmt.Sprintf("Warehouse.clickhouse.%s.maxLoadDelay", destinationID),
fmt.Sprintf("Warehouse.clickhouse.%s.maxLoadDelay", workspaceID),
"Warehouse.clickhouse.maxLoadDelay",
)
return time.Duration(float64(maxDelay) * (1 - r.Float64()))
Expand Down Expand Up @@ -503,7 +503,7 @@ func (ch *Clickhouse) typecastDataFromType(data, dataType string) interface{} {

// loadTable loads table to clickhouse from the load files
func (ch *Clickhouse) loadTable(ctx context.Context, tableName string, tableSchemaInUpload model.TableSchema) (err error) {
if err = misc.SleepCtx(ctx, ch.config.randomLoadDelay(ch.Warehouse.Destination.ID)); err != nil {
if err = misc.SleepCtx(ctx, ch.config.randomLoadDelay(ch.Warehouse.WorkspaceID)); err != nil {
return
}
if ch.UseS3CopyEngineForLoading() {
Expand Down

0 comments on commit f06fc0b

Please sign in to comment.