RFR: 1512: MirrorBot may get stuck failing to clone repository

Zhao Song duke at openjdk.org
Fri Sep 23 16:58:04 UTC 2022


On Fri, 23 Sep 2022 13:48:35 GMT, Erik Joelsson <erikj 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());

Got it! Will change it.

> 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.

Sure.

-------------

PR: https://git.openjdk.org/skara/pull/1374


More information about the skara-dev mailing list