From 74a08900cd51474fc3097ba64b28a6d81d3288ca Mon Sep 17 00:00:00 2001 From: zhijian Date: Fri, 3 Jan 2025 13:32:45 +0800 Subject: [PATCH] The `upload-hours` parameter supports `-` as a separator (#5494) Signed-off-by: zhijian --- cmd/flags.go | 2 +- pkg/chunk/cached_store.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/flags.go b/cmd/flags.go index 55ce9819df31..925556904292 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -197,7 +197,7 @@ func dataCacheFlags() []cli.Flag { }, &cli.StringFlag{ Name: "upload-hours", - Usage: "(start,end) hour of a day between which the delayed blocks can be uploaded", + Usage: "(start-end) hour of a day between which the delayed blocks can be uploaded", }, &cli.StringFlag{ Name: "cache-dir", diff --git a/pkg/chunk/cached_store.go b/pkg/chunk/cached_store.go index 34c446e24145..993cdfe55a08 100644 --- a/pkg/chunk/cached_store.go +++ b/pkg/chunk/cached_store.go @@ -634,7 +634,11 @@ func (c *Config) parseHours() (start, end int, err error) { if c.UploadHours == "" { return } - ps := strings.Split(c.UploadHours, ",") + split := "," + if strings.Contains(c.UploadHours, "-") { + split = "-" + } + ps := strings.Split(c.UploadHours, split) if len(ps) != 2 { err = errors.New("unexpected number of fields") return