diff --git a/.gitignore b/.gitignore index ac3dd36..1a1d885 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ texpixel /vendor -dev_deploy.sh \ No newline at end of file +dev_deploy.sh +speed_take.sh \ No newline at end of file diff --git a/internal/service/recognition_service.go b/internal/service/recognition_service.go index 9643d45..1397516 100644 --- a/internal/service/recognition_service.go +++ b/internal/service/recognition_service.go @@ -738,6 +738,10 @@ func (s *RecognitionService) processMathpixTask(ctx context.Context, taskID int6 endpoint := "https://api.mathpix.com/v3/text" + startTime := time.Now() + + log.Info(ctx, "func", "processMathpixTask", "msg", "MathpixApi_Start", "start_time", startTime) + resp, err := s.httpClient.RequestWithRetry(ctx, http.MethodPost, endpoint, bytes.NewReader(jsonData), headers) if err != nil { log.Error(ctx, "func", "processMathpixTask", "msg", "Mathpix API 请求失败", "error", err) @@ -745,6 +749,8 @@ func (s *RecognitionService) processMathpixTask(ctx context.Context, taskID int6 } defer resp.Body.Close() + log.Info(ctx, "func", "processMathpixTask", "msg", "MathpixApi_End", "end_time", time.Now(), "duration", time.Since(startTime)) + body := &bytes.Buffer{} if _, err = body.ReadFrom(resp.Body); err != nil { log.Error(ctx, "func", "processMathpixTask", "msg", "读取响应体失败", "error", err) @@ -790,6 +796,8 @@ func (s *RecognitionService) processMathpixTask(ctx context.Context, taskID int6 return err } + log.Info(ctx, "func", "processMathpixTask", "msg", "saveLog", "end_time", time.Now(), "duration", time.Since(startTime)) + if result == nil { // 创建新结果 err = resultDao.Create(dao.DB.WithContext(ctx), dao.RecognitionResult{