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

Method AbstractPush

src/main/java/top/misec/push/AbstractPush.java:37–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 protected final RequestConfig requestConfig;
36
37 public AbstractPush() {
38
39 HttpHost proxy = ConfigLoader.helperConfig.getPushConfig().getProxy();
40 RequestConfig.Builder builder = RequestConfig.custom()
41 .setConnectTimeout(5000)
42 .setConnectionRequestTimeout(5000)
43 .setSocketTimeout(10000);
44 if (null != proxy) {
45 builder.setProxy(proxy);
46 }
47 requestConfig = builder.build();
48
49 retryer = RetryerBuilder.<JsonObject>newBuilder()
50 // 出现异常进行重试
51 .retryIfException()
52 // 检查结果进行重试
53 .retryIfResult((it) -> !checkPushStatus(it))
54 // 每次重试等待策略
55 .withWaitStrategy(WaitStrategies.fixedWait(1, TimeUnit.SECONDS))
56 // 重试停止策略
57 .withStopStrategy(StopStrategies.stopAfterAttempt(3))
58 // 持续时间限制
59 .withAttemptTimeLimiter(AttemptTimeLimiters.noTimeLimit())
60 // 重试监听器
61 .withRetryListener(this)
62 .build();
63 }
64
65 @Override
66 public final PushResult doPush(PushMetaInfo metaInfo, String content) {

Callers

nothing calls this directly

Calls 2

checkPushStatusMethod · 0.95
getProxyMethod · 0.80

Tested by

no test coverage detected