Skip to content

Commit

Permalink
fix: timer
Browse files Browse the repository at this point in the history
  • Loading branch information
istae committed Sep 21, 2023
1 parent b9f308f commit f8adc4b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/storer/compact.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ func Compact(ctx context.Context, basePath string, opts *Options, validate bool)

logger := opts.Logger

n := time.Now()

logger.Info("starting compaction")

store, err := initStore(basePath, opts)
Expand Down Expand Up @@ -57,6 +55,8 @@ func Compact(ctx context.Context, basePath string, opts *Options, validate bool)
validationWork(ctx, logger, store, sharkyRecover)
}

n := time.Now()

iteratateItemsC := make(chan chunkstore.IterateResult)
chunkstore.Iterate(ctx, store, iteratateItemsC)

Expand Down Expand Up @@ -144,6 +144,11 @@ func Compact(ctx context.Context, basePath string, opts *Options, validate bool)

func validationWork(ctx context.Context, logger log.Logger, store storage.Store, sharky *sharky.Recovery) {

n := time.Now()
defer func() {
logger.Info("validation finished", "duration", time.Since(n))
}()

iteratateItemsC := make(chan chunkstore.IterateResult)
chunkstore.Iterate(ctx, store, iteratateItemsC)

Expand Down

0 comments on commit f8adc4b

Please sign in to comment.