Skip to content

Commit

Permalink
refactor: rename archive service
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao committed Nov 23, 2023
1 parent fdb9063 commit 08ee8ba
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
type CommandDeps struct {
fx.In

DropReportArchiveService *service.Archive
ArchiveService *service.Archive
}

func Command(depsFn func() CommandDeps) *cli.Command {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func run(ctx *cli.Context, deps CommandDeps, dateStr string, deleteAfterArchive
return errors.Wrap(err, "failed to parse date")
}

if err = deps.DropReportArchiveService.ArchiveByDate(ctx.Context, date, deleteAfterArchive); err != nil {
if err = deps.ArchiveService.ArchiveByDate(ctx.Context, date, deleteAfterArchive); err != nil {
return errors.Wrap(err, "failed to run archiveDropReports")
}

Expand Down
4 changes: 2 additions & 2 deletions internal/controller/meta/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type AdminController struct {
TimeRangeService *service.TimeRange
ExportService *service.Export
AccountService *service.Account
DropReportArchiveService *service.Archive
ArchiveService *service.Archive
}

func RegisterAdmin(admin *svr.Admin, c AdminController) {
Expand Down Expand Up @@ -720,7 +720,7 @@ func (c *AdminController) ArchiveDropReports(ctx *fiber.Ctx) error {
return ctx.Status(fiber.StatusBadRequest).SendString("invalid date")
}

err = c.DropReportArchiveService.ArchiveByDate(ctx.UserContext(), date, request.DeleteAfterArchive)
err = c.ArchiveService.ArchiveByDate(ctx.UserContext(), date, request.DeleteAfterArchive)
if err != nil {
flog.ErrorFrom(ctx, "archive.drop_report").
Err(err).
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions internal/workers/calcwkr/calcwkr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import (

type WorkerDeps struct {
fx.In
DropMatrixService *service.DropMatrix
PatternMatrixService *service.PatternMatrix
TrendService *service.Trend
SiteStatsService *service.SiteStats
DropReportArchiveService *service.Archive
RedSync *redsync.Redsync
DropMatrixService *service.DropMatrix
PatternMatrixService *service.PatternMatrix
TrendService *service.Trend
SiteStatsService *service.SiteStats
ArchiveService *service.Archive
RedSync *redsync.Redsync
}

type Worker struct {
Expand Down Expand Up @@ -130,7 +130,7 @@ func (w *Worker) doMainCalc(sourceCategories []string) {
if server == "CN" {
// Archive
if err = w.microtask(ctx, "archive", server, func() error {
err := w.DropReportArchiveService.ArchiveByGlobalConfig(ctx)
err := w.ArchiveService.ArchiveByGlobalConfig(ctx)
return err
}); err != nil {
return err
Expand Down

0 comments on commit 08ee8ba

Please sign in to comment.