RFR: 1512: MirrorBot may get stuck failing to clone repository
Erik Joelsson
erikj at openjdk.org
Fri Sep 23 13:54:13 UTC 2022
On Tue, 13 Sep 2022 21:14:07 GMT, Zhao Song <duke at openjdk.org> wrote:
> Optimized the logic in MirrorBot.
>
> When MirrorBot tries to create a directory, the directory will have a 'temporary' suffix, then it will attempts cloning. It the cloning succeed, the suffix will be removed. If the clone fails or the bot happens to die, the directory will retain the suffix. On the next time, if we try to rerun the bot, the bot will detect the temporary directory and will delete the temporary directory first, therefore, the bot will not get stuck.
bots/mirror/src/main/java/org/openjdk/skara/bots/mirror/MirrorBot.java line 92:
> 90: log.info("Found existing scratch directory for " + to.name());
> 91: repo = Repository.get(dir).orElseGet(() -> {
> 92: log.info("The existing scratch directory has problem. Now recloning " + from.name());
Suggestion:
log.info("The existing scratch directory is not a valid repository. Recloning " + from.name());
bots/mirror/src/test/java/org/openjdk/skara/bots/mirror/MirrorBotTests.java line 485:
> 483: URLEncoder.encode(toHostedRepo.webUrl().toString(), StandardCharsets.UTF_8);
> 484: var dir_temporary = storage.resolve(sanitizedUrl);
> 485: Files.createDirectories(dir_temporary);
Please stick with the existing style of camelCase for identifiers.
-------------
PR: https://git.openjdk.org/skara/pull/1374
More information about the skara-dev
mailing list