Skip to content

Commit

Permalink
fix(storage): async insert (#1704)
Browse files Browse the repository at this point in the history
  • Loading branch information
hekike authored Oct 18, 2024
1 parent 9bcec1a commit 14322da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions openmeter/sink/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ func (c *ClickHouseStorage) BatchInsert(ctx context.Context, messages []sinkmode
// With the `wait_for_async_insert` setting, you can configure
// if you want an insert statement to return with an acknowledgment
// either immediately after the data got inserted into the buffer.
ctx = clickhouse.Context(ctx, clickhouse.WithStdAsync(c.config.AsyncInsertWait))
err = c.config.ClickHouse.AsyncInsert(ctx, sql, c.config.AsyncInsertWait, args...)
} else {
err = c.config.ClickHouse.Exec(ctx, sql, args...)
}

err = c.config.ClickHouse.Exec(ctx, sql, args...)
if err != nil {
return fmt.Errorf("failed to batch insert events: %w", err)
}
Expand Down

0 comments on commit 14322da

Please sign in to comment.