Skip to content

http.postMultipart 和 http.postJson Read timed out #470

@wangwang93517

Description

@wangwang93517

我的代码逻辑是:1、get 请求拿任务 2、执行任务 3、提交任务执行结果(带截图)

let result = http.postMultipart(
      url,
      {
        taskId: task.id.toString(),
        image: open(screenFilePath),
      },
      {
        timeout: 30000,
        headers: {
          Authorization: token,
        },
      }
    );

  var img = images.read(screenFilePath);
    var base64Str = images.toBase64(img, "jpg", 50);
    images.recycle(img); // 释放
    img = null;
 
    let result = http.postJson(
        url,
      {
        taskId: task.id.toString(),
        image: base64Str,
      },
      {
        timeout: 30000,
        headers: {
             Authorization: token,
        },
      }
    );

使用http.postMultipart 和 http.postJson 95% 的概率 Read timed out

最神奇的是Read timed out.后 下面的所有请求都是Read timed out了 .

然后我单独调试接口 又没有问题了 只要把接口放到整个流程里就会出现 Read timed out

Metadata

Metadata

Assignees

No one assigned

    Labels

    Accepted 🌱 受理Maintainer may be busy resolving or fixing the labeled issuesDelayed ⌛ 延期Issues have been accepted but won't be settled in timeFeedback Awaited 🕒 等待反馈Waiting for the feedback from issue creater and issue will be closed if duration is over one monthProposal 💡 方案Issue creater's own proposal which may be really helpfulReinforcement ✨ 强化Issues for higher quality of being compatible

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions