diff --git a/internal/app/appconfig/spec.go b/internal/app/appconfig/spec.go index 7dc57e32..f4495fe0 100644 --- a/internal/app/appconfig/spec.go +++ b/internal/app/appconfig/spec.go @@ -125,7 +125,8 @@ type ConfigSpec struct { // We don't want to show all patterns because it will be too many. So we set a limit here (default 19) PatternMatrixLimit int `split_words:"true" default:"19"` - DropReportArchiveBatchSize int `split_words:"true" default:"1000"` + DropReportArchiveEnabled bool `split_words:"true" default:"false"` + DropReportArchiveBatchSize int `split_words:"true" default:"1000"` DropReportArchiveS3Bucket string `required:"true" split_words:"true"` DropReportArchiveS3Region string `required:"true" split_words:"true"` diff --git a/internal/workers/calcwkr/calcwkr.go b/internal/workers/calcwkr/calcwkr.go index a1fcc54a..3967a6a9 100644 --- a/internal/workers/calcwkr/calcwkr.go +++ b/internal/workers/calcwkr/calcwkr.go @@ -18,6 +18,8 @@ import ( type WorkerDeps struct { fx.In + + Config *appconfig.Config DropMatrixService *service.DropMatrix PatternMatrixService *service.PatternMatrix TrendService *service.Trend @@ -127,7 +129,7 @@ func (w *Worker) doMainCalc(sourceCategories []string) { } // server == "CN": we only run archive job on a singular server - if server == "CN" { + if w.Config.DropReportArchiveEnabled && server == "CN" { // Archive if err = w.microtask(ctx, "archive", server, func() error { err := w.ArchiveService.ArchiveByGlobalConfig(ctx)