Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: bufferflies <1045931706@qq.com>
  • Loading branch information
bufferflies committed Aug 11, 2023
1 parent 035ec42 commit 3e8dc5b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ func syncConfig(ctx context.Context, manager *config.StoreConfigManager, stores
for index := 0; index < len(stores); index++ {
select {
case <-ctx.Done():
log.Info("stop sync store config job due to server shutdown")
log.Info("stop sync store config job due to raft cluster exited")
return false
default:
}
Expand Down
7 changes: 2 additions & 5 deletions server/config/store_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package config

import (
"bytes"
"context"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -231,19 +230,17 @@ func newTiKVConfigSource(schema string, client *http.Client) *TiKVConfigSource {
func (s TiKVConfigSource) GetConfig(ctx context.Context, statusAddress string) (*StoreConfig, error) {
url := fmt.Sprintf("%s://%s/config", s.schema, statusAddress)
ctx, cancel := context.WithTimeout(ctx, clientTimeout)
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, bytes.NewBuffer(nil))
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
defer cancel()
if err != nil {
cancel()
return nil, fmt.Errorf("failed to create store config http request: %w", err)

Check warning on line 236 in server/config/store_config.go

View check run for this annotation

Codecov / codecov/patch

server/config/store_config.go#L236

Added line #L236 was not covered by tests
}
resp, err := s.client.Do(req)
if err != nil {
cancel()
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)

Check warning on line 243 in server/config/store_config.go

View check run for this annotation

Codecov / codecov/patch

server/config/store_config.go#L243

Added line #L243 was not covered by tests
cancel()
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3e8dc5b

Please sign in to comment.