Fix repo sizing job cron (#948)

This commit is contained in:
Shubham Agrawal 2024-01-08 09:19:30 +00:00 committed by Harness
parent 7ff83849aa
commit 18c81b04b4
2 changed files with 5 additions and 1 deletions

View File

@ -103,6 +103,10 @@ func worker(ctx context.Context, c *Calculator, wg *sync.WaitGroup, taskCh <-cha
log.Error().Msgf("failed to get repo size: %s", err.Error())
continue
}
if sizeOut.Size == sizeInfo.Size {
log.Debug().Msg("repo size not changed")
continue
}
if err := c.repoStore.UpdateSize(ctx, sizeInfo.ID, sizeOut.Size); err != nil {
log.Error().Msgf("failed to update repo size: %s", err.Error())

View File

@ -312,7 +312,7 @@ type Config struct {
RepoSize struct {
Enabled bool `envconfig:"GITNESS_REPO_SIZE_ENABLED" default:"true"`
CRON string `envconfig:"GITNESS_REPO_SIZE_CRON" default:"* * 0 * * * *"`
CRON string `envconfig:"GITNESS_REPO_SIZE_CRON" default:"0 0 * * *"`
MaxDuration time.Duration `envconfig:"GITNESS_REPO_SIZE_MAX_DURATION" default:"15m"`
NumWorkers int `envconfig:"GITNESS_REPO_SIZE_NUM_WORKERS" default:"5"`
}