generate cancel
This commit is contained in:
@@ -3174,15 +3174,15 @@ public class PythonService {
|
||||
throw new BusinessException("cloth-classification.interface.exception");
|
||||
}
|
||||
|
||||
public Boolean cancelGenerateTask(String taskId) {
|
||||
public Boolean cancelGenerateTask(String taskId, String path) {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
.pingInterval(5, TimeUnit.SECONDS)//websocket轮训间隔(单位:秒)
|
||||
.readTimeout(60, TimeUnit.SECONDS)//读取超时(单位:秒)
|
||||
.writeTimeout(60, TimeUnit.SECONDS)//写入超时(单位:秒)
|
||||
.build();
|
||||
// String url = accessPythonIp + ":" + accessPythonPort + "/api/generate_cancel/" + taskId;
|
||||
String url = fastApiPythonAddress + "/api/generate_cancel/" + taskId;
|
||||
String url = accessPythonIp + ":" + accessPythonPort + path + taskId;
|
||||
// String url = fastApiPythonAddress + "/api/generate_cancel/" + taskId;
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
|
||||
@@ -3193,14 +3193,14 @@ public class PythonService {
|
||||
log.info("cancelGenerateTask请求入参content###{}", taskId);
|
||||
response = client.newCall(request).execute();
|
||||
} catch (IOException ioException) {
|
||||
log.error("PythonService##cancelGenerateTask异常###{}", ExceptionUtil.getThrowableList(ioException));
|
||||
log.error("PythonService##cancelGenerateTask异常###{}", response);
|
||||
return null;
|
||||
}
|
||||
int responseCode = response.code();
|
||||
response.close();
|
||||
|
||||
if (responseCode != HttpURLConnection.HTTP_OK) {
|
||||
log.info("generate-python 取消请求失败");
|
||||
log.info("generate-python 取消请求失败. {}", response);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
log.info("generate-python 取消请求成功");
|
||||
|
||||
Reference in New Issue
Block a user