Skip to content

Commit

Permalink
feat: add batchsize to config
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Nov 21, 2023
1 parent d5aae82 commit ac61e20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 2 additions & 0 deletions internal/app/appconfig/spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,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"`

DropReportArchiveS3Bucket string `required:"true" split_words:"true"`
DropReportArchiveS3Region string `required:"true" split_words:"true"`
AWSAccessKey string `required:"true" split_words:"true"`
Expand Down
5 changes: 2 additions & 3 deletions internal/service/drop_report_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const (
RealmDropReportExtras = "drop_report_extras"

ArchiveS3Prefix = "v1/"
BatchSize = 1000
)

type Archive struct {
Expand Down Expand Up @@ -118,7 +117,7 @@ func (s *Archive) populateDropReportsToArchiver(ctx context.Context, date time.T
var err error
var page, totalCount, firstId, lastId int
for {
dropReports, cursor, err = s.DropReportService.GetDropReportsForArchive(ctx, &cursor, date, 1000)
dropReports, cursor, err = s.DropReportService.GetDropReportsForArchive(ctx, &cursor, date, s.Config.DropReportArchiveBatchSize)
if err != nil {
return 0, 0, errors.Wrap(err, "failed to extract drop reports")
}
Expand Down Expand Up @@ -160,7 +159,7 @@ func (s *Archive) populateDropReportExtrasToArchiver(ctx context.Context, idIncl
var err error
var page, totalCount int
for {
extras, cursor, err = s.DropReportExtraService.GetDropReportExtraForArchive(ctx, &cursor, idInclusiveStart, idInclusiveEnd, 1000)
extras, cursor, err = s.DropReportExtraService.GetDropReportExtraForArchive(ctx, &cursor, idInclusiveStart, idInclusiveEnd, s.Config.DropReportArchiveBatchSize)
if err != nil {
return errors.Wrap(err, "failed to extract drop report extras")
}
Expand Down

0 comments on commit ac61e20

Please sign in to comment.