feat: 优化代码

This commit is contained in:
tbphp
2025-07-11 13:47:36 +08:00
parent e7f0270d82
commit 395d48c3e7
7 changed files with 10 additions and 29 deletions

View File

@@ -39,7 +39,7 @@ func NewKeyCronService(
// Start begins the cron job execution.
func (s *KeyCronService) Start() {
logrus.Info("Starting KeyCronService...")
logrus.Debug("Starting KeyCronService...")
s.wg.Add(1)
go s.runLoop()
}

View File

@@ -170,7 +170,7 @@ func (s *LeaderService) maintainLeadershipLoop() {
ticker := time.NewTicker(leaderRenewalInterval)
defer ticker.Stop()
logrus.Info("Leadership maintenance loop started.")
logrus.Debug("Leadership maintenance loop started.")
for {
select {
case <-ticker.C:
@@ -200,7 +200,7 @@ func (s *LeaderService) tryToBeLeader() error {
return fmt.Errorf("failed to acquire lock: %w", err)
}
if acquired {
logrus.WithField("nodeID", s.nodeID).Info("Successfully acquired leadership.")
logrus.WithField("nodeID", s.nodeID).Debug("Successfully acquired leadership.")
s.isLeader.Store(true)
}
return nil

View File

@@ -30,7 +30,7 @@ func NewLogCleanupService(db *gorm.DB, settingsManager *config.SystemSettingsMan
// Start 启动日志清理服务
func (s *LogCleanupService) Start() {
go s.run()
logrus.Info("Log cleanup service started")
logrus.Debug("Log cleanup service started")
}
// Stop 停止日志清理服务