Commit a56bc9bd by 毛树良

<fix>:繁星3.0转发优化

1 parent bf718b51
...@@ -68,8 +68,10 @@ public class ForwardWriter implements ItemWriter<ForwardContent> { ...@@ -68,8 +68,10 @@ public class ForwardWriter implements ItemWriter<ForwardContent> {
.bodyToMono(String.class); .bodyToMono(String.class);
String block = response.block(Duration.ofSeconds(20)); String block = response.block(Duration.ofSeconds(20));
log.info("数据推送完成,对接名称:[{}],结果:[{}]", forward.getName(), block); log.info("数据推送完成,对接名称:[{}],结果:[{}]", forward.getName(), block);
failed = 0;// 发送完成重置failed为0
} catch (Exception e) { } catch (Exception e) {
failed += 1; failed += 1;
log.error("发送失败次数:{},对接名称[{}],url:[{}],error:[{}]", failed, forward.getName(), forward.getUrl(), e.getMessage());
if (failed == 3) { if (failed == 3) {
log.error("发送失败,对接名称[{}],url:[{}],error:[{}]", forward.getName(), forward.getUrl(), e.getMessage()); log.error("发送失败,对接名称[{}],url:[{}],error:[{}]", forward.getName(), forward.getUrl(), e.getMessage());
} }
...@@ -87,6 +89,7 @@ public class ForwardWriter implements ItemWriter<ForwardContent> { ...@@ -87,6 +89,7 @@ public class ForwardWriter implements ItemWriter<ForwardContent> {
map.put("lastSendTime", new Date()); map.put("lastSendTime", new Date());
map.expire(10, TimeUnit.DAYS); map.expire(10, TimeUnit.DAYS);
} else if (failed < 3) { } else if (failed < 3) {
log.info("发送失败进行重发, 发送任务Id:{}, 已失败次数:{}, 该任务失败次数:{}", this, failed, this.failed);
ForwardApp.THREAD_POOL_EXECUTOR.submit(this); ForwardApp.THREAD_POOL_EXECUTOR.submit(this);
} else { } else {
log.info("失败次数超过三次,不再发送,forwardId:{}", forward.getId()); log.info("失败次数超过三次,不再发送,forwardId:{}", forward.getId());
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!