Skip to content

Commit

Permalink
feat: add archive switch
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Dec 19, 2023
1 parent 509a5b1 commit c09c711
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion internal/app/appconfig/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
4 changes: 3 additions & 1 deletion internal/workers/calcwkr/calcwkr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (

type WorkerDeps struct {
fx.In

Config *appconfig.Config
DropMatrixService *service.DropMatrix
PatternMatrixService *service.PatternMatrix
TrendService *service.Trend
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c09c711

Please sign in to comment.