refactor: 引入日志切割库、indexApi拆分等

This commit is contained in:
meilin.huang
2024-01-23 19:30:28 +08:00
parent d530365ef9
commit e4d13f3377
43 changed files with 324 additions and 241 deletions

View File

@@ -28,7 +28,6 @@ type dbScheduler struct {
restoreHistoryRepo repository.DbRestoreHistory `inject:"DbRestoreHistoryRepo"`
binlogRepo repository.DbBinlog `inject:"DbBinlogRepo"`
binlogHistoryRepo repository.DbBinlogHistory `inject:"DbBinlogHistoryRepo"`
binlogTimes map[uint64]time.Time
}
func newDbScheduler() *dbScheduler {
@@ -53,7 +52,7 @@ func (s *dbScheduler) repo(typ entity.DbJobType) repository.DbJob {
case entity.DbJobTypeBinlog:
return s.binlogRepo
default:
panic(errors.New(fmt.Sprintf("无效的数据库任务类型: %v", typ)))
panic(fmt.Errorf("无效的数据库任务类型: %v", typ))
}
}
@@ -281,7 +280,7 @@ func (s *dbScheduler) runJob(ctx context.Context, job entity.DbJob) {
case entity.DbJobTypeBinlog:
errRun = s.fetchBinlogMysql(ctx, job)
default:
errRun = errors.New(fmt.Sprintf("无效的数据库任务类型: %v", typ))
errRun = fmt.Errorf("无效的数据库任务类型: %v", typ)
}
status := entity.DbJobSuccess
if errRun != nil {