Skip to content

Commit ff97cb8

Browse files
authored
Fixed panic on concurrent context key map write (#1284)
1 parent 4a3adc4 commit ff97cb8

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

conn_http.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,10 @@ func (h *httpConnect) writeData(block *proto.Block) error {
372372
return nil
373373
}
374374

375-
func (h *httpConnect) readData(ctx context.Context, reader *chproto.Reader) (*proto.Block, error) {
376-
opts := queryOptions(ctx)
375+
func (h *httpConnect) readData(reader *chproto.Reader, timezone *time.Location) (*proto.Block, error) {
377376
location := h.location
378-
if opts.userLocation != nil {
379-
location = opts.userLocation
377+
if timezone != nil {
378+
location = timezone
380379
}
381380

382381
block := proto.Block{Timezone: location}

conn_http_query.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (h *httpConnect) query(ctx context.Context, release func(*connect, error),
7373
return nil, err
7474
}
7575
chReader := chproto.NewReader(reader)
76-
block, err := h.readData(ctx, chReader)
76+
block, err := h.readData(chReader, options.userLocation)
7777
if err != nil && !errors.Is(err, io.EOF) {
7878
res.Body.Close()
7979
h.compressionPool.Put(rw)
@@ -91,7 +91,7 @@ func (h *httpConnect) query(ctx context.Context, release func(*connect, error),
9191
)
9292
go func() {
9393
for {
94-
block, err := h.readData(ctx, chReader)
94+
block, err := h.readData(chReader, options.userLocation)
9595
if err != nil {
9696
// ch-go wraps EOF errors
9797
if !errors.Is(err, io.EOF) {

0 commit comments

Comments
 (0)