From 038ec07cf23c5aad1b13865ff0503a0217f11664 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Tue, 17 Jan 2023 10:32:36 +0100 Subject: [PATCH] Increase sleep duration after creating GitHub issue in Bomr See gh-30304 --- .../bomr/github/StandardGitHubRepository.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java index 2c9059f3ec..1920b10698 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/github/StandardGitHubRepository.java @@ -16,6 +16,7 @@ package org.springframework.boot.build.bom.bomr.github; +import java.time.Duration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -52,14 +53,10 @@ final class StandardGitHubRepository implements GitHubRepository { requestBody.put("labels", labels); } requestBody.put("body", body); - try { - Thread.sleep(1000); - } - catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - } try { ResponseEntity response = this.rest.postForEntity("issues", requestBody, Map.class); + // See gh-30304 + sleep(Duration.ofSeconds(3)); return (Integer) response.getBody().get("number"); } catch (RestClientException ex) { @@ -96,4 +93,13 @@ final class StandardGitHubRepository implements GitHubRepository { return body.stream().map(mapper).collect(Collectors.toList()); } + private static void sleep(Duration duration) { + try { + Thread.sleep(duration.toMillis()); + } + catch (InterruptedException ex) { + Thread.currentThread().interrupt(); + } + } + }