|
|
@@ -162,23 +162,29 @@ public class VideoApiService {
|
|
|
|
|
|
public void deleteVideo(Long uid, Long videoId) {
|
|
|
String url = videoApiHost + "/longvideoapi/openapi/video/delete";
|
|
|
- JSONObject res = null;
|
|
|
- try {
|
|
|
- JSONObject param = new JSONObject();
|
|
|
- param.put("loginUid", uid);
|
|
|
- param.put("videoId", videoId);
|
|
|
- String post = httpPoolClient.post(url, param.toJSONString());
|
|
|
- res = JSONObject.parseObject(post);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("VideoApiService deleteVideo error", e);
|
|
|
- }
|
|
|
- if (Objects.isNull(res)) {
|
|
|
- throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED);
|
|
|
- }
|
|
|
- if (res.getInteger("code") != 0) {
|
|
|
- log.error("VideoApiService deleteVideo error, videoId={} res={}", videoId, res);
|
|
|
- throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED.getCode(),
|
|
|
- ExceptionEnum.VIDEO_DELETE_FAILED.getMsg() + "," + res.getString("msg"));
|
|
|
+ int retryCount = 3;
|
|
|
+ while (retryCount > 0) {
|
|
|
+ try {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("loginUid", uid);
|
|
|
+ param.put("videoId", videoId);
|
|
|
+ String post = httpPoolClient.post(url, param.toJSONString());
|
|
|
+ JSONObject res = JSONObject.parseObject(post);
|
|
|
+ if (Objects.isNull(res)) {
|
|
|
+ throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED);
|
|
|
+ }
|
|
|
+ if (res.getInteger("code") != 0) {
|
|
|
+ log.error("VideoApiService deleteVideo error, videoId={} res={}", videoId, res);
|
|
|
+ throw new CommonException(ExceptionEnum.VIDEO_DELETE_FAILED.getCode(),
|
|
|
+ ExceptionEnum.VIDEO_DELETE_FAILED.getMsg() + "," + res.getString("msg"));
|
|
|
+ } else {
|
|
|
+ log.info("VideoApiService deleteVideo success, uid:{} videoId={}", uid, videoId);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("VideoApiService deleteVideo error", e);
|
|
|
+ }
|
|
|
+ retryCount--;
|
|
|
}
|
|
|
}
|
|
|
|