同步失败时展示错误信息并增加后端状态日志
This commit is contained in:
@@ -123,6 +123,13 @@ func (s *StockSyncService) finishJob(ctx context.Context, jobID string, recordsC
|
||||
}
|
||||
if err := s.db.WithContext(ctx).Model(&models.StockSyncJob{}).Where("id = ?", jobID).Updates(updates).Error; err != nil {
|
||||
log.Printf("[stock sync] update job %s failed: %v", jobID, err)
|
||||
return
|
||||
}
|
||||
|
||||
var job models.StockSyncJob
|
||||
if err := s.db.WithContext(ctx).Where("id = ?", jobID).First(&job).Error; err == nil {
|
||||
log.Printf("[stock sync] job %s final state: status=%s, started_at=%v, finished_at=%v",
|
||||
jobID, job.Status, job.StartedAt, job.FinishedAt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user