(PushMetaInfo metaInfo, String content)
| 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 { |
nothing calls this directly
no test coverage detected