MCPcopy Create free account
hub / github.com/OreosLab/bili / doPush

Method doPush

src/main/java/top/misec/push/AbstractPush.java:65–87  ·  view source on GitHub ↗
(PushMetaInfo metaInfo, String content)

Source from the content-addressed store, hash-verified

63 }
64
65 @Override
66 public final PushResult doPush(PushMetaInfo metaInfo, String content) {
67 String url = generatePushUrl(metaInfo);
68 assert null != url : "推送URL不能为空";
69 List<String> pushList = segmentation(metaInfo, content);
70 PushResult pushResult = PushResult.success();
71 for (String pushItemContent : pushList) {
72 String pushContent = generatePushBody(metaInfo, pushItemContent);
73 PushResult result = push2Target(url, pushContent);
74 if (!result.isSuccess()) {
75 pushResult = PushResult.failed();
76 break;
77 }
78 if (pushList.size() > 1) {
79 try {
80 // 限速
81 TimeUnit.MILLISECONDS.sleep(1500);
82 } catch (InterruptedException ignore) {
83 }
84 }
85 }
86 return pushResult;
87 }
88
89 private PushResult push2Target(String url, String pushContent) {
90 try {

Callers

nothing calls this directly

Calls 6

generatePushUrlMethod · 0.95
segmentationMethod · 0.95
successMethod · 0.95
generatePushBodyMethod · 0.95
push2TargetMethod · 0.95
failedMethod · 0.95

Tested by

no test coverage detected