Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed panic on concurrent context key map write #1284

Merged
merged 1 commit into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions conn_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,10 @@ func (h *httpConnect) writeData(block *proto.Block) error {
return nil
}

func (h *httpConnect) readData(ctx context.Context, reader *chproto.Reader) (*proto.Block, error) {
opts := queryOptions(ctx)
func (h *httpConnect) readData(reader *chproto.Reader, timezone *time.Location) (*proto.Block, error) {
location := h.location
if opts.userLocation != nil {
location = opts.userLocation
if timezone != nil {
location = timezone
}

block := proto.Block{Timezone: location}
Expand Down
4 changes: 2 additions & 2 deletions conn_http_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (h *httpConnect) query(ctx context.Context, release func(*connect, error),
return nil, err
}
chReader := chproto.NewReader(reader)
block, err := h.readData(ctx, chReader)
block, err := h.readData(chReader, options.userLocation)
if err != nil && !errors.Is(err, io.EOF) {
res.Body.Close()
h.compressionPool.Put(rw)
Expand All @@ -91,7 +91,7 @@ func (h *httpConnect) query(ctx context.Context, release func(*connect, error),
)
go func() {
for {
block, err := h.readData(ctx, chReader)
block, err := h.readData(chReader, options.userLocation)
if err != nil {
// ch-go wraps EOF errors
if !errors.Is(err, io.EOF) {
Expand Down
Loading