添加webhook数量上限异常处理

This commit is contained in:
wanjia 2023-04-12 10:20:49 +08:00
parent c9dee61361
commit 43159e6a4d
1 changed files with 3 additions and 3 deletions

View File

@ -34,15 +34,15 @@ public class AsyncCallWebhookService {
private InstallMapper installMapper;
@Async("taskExecutor")
@Retryable(value = RuntimeException.class, maxAttempts = 3, backoff = @Backoff(delay = 2500,multiplier = 2))
@Retryable(value = RuntimeException.class, maxAttempts = 3, backoff = @Backoff(delay = 2000,multiplier = 1.5))
public void asyncAddWebhookAndRetry(Integer currentUserId, List<BotLimitEvent> botLimitEvents, InstallBot installBot) throws RuntimeException, JsonProcessingException {
Webhook webhook = userService.getWebhook(botLimitEvents, installBot.getInstallerId());
//先获取webhookId构造webhook
Object[] objects = new Object[]{installBot.getRepoOwner(), installBot.getStoreRepo()};
Response response = api.addWebhook(currentUserId, objects, webhook);
if (response.getCode().equals("error")) {
log.info("installBotId: " + installBot.getId());
JSONObject object = JSONObject.parseObject(response.getData().toString());
if (response.getCode().equals("error") || (object.get("status")!=null&&!object.get("status").equals(0))) {
installBot.setWebhookId(-1);
installBot.setWebhookResponseMsg(response.getData().toString());
installMapper.updateById(installBot);