feat: add log for time
This commit is contained in:
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user