RFR: 2340: CommitCommentsWorkItem executing in GitLab takes a lot of time.

Zhao Song zsong at openjdk.org
Fri Aug 9 22:08:01 UTC 2024


On Fri, 9 Aug 2024 19:43:46 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> Currently, if a user comments under a commit named "Merge" in GitLab, the CommitCommentsWorkItem will take about 8 hours to complete. This delay occurs because the Skara bot checks all commits named "Merge" in the repository.
>> 
>> In the previous implementation, the bot fetched all the commit comments for all candidates and then attempted to find the one with the correct ID. With my patch, the bot now fetches the commit comment for only one candidate at a time and looks for the correct ID.
>
> forge/src/main/java/org/openjdk/skara/forge/gitlab/GitLabRepository.java line 560:
> 
>> 558:         // eventually clear up on subsequent tries.
>> 559:         Optional<CommitComment> found = Optional.empty();
>> 560:         for (var candidate : candidates) {
> 
> Are you sure this makes a difference? Streams, or at least flatMap, aren't supposed to be eager, so I was expecting the current implementation to do exactly the same thing.

I am not sure what do you mean by eager. I think in the original implementation, it will retrieve all the commit comments before filtering, so with so many candidates, it's inefficient.

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

PR Review Comment: https://git.openjdk.org/skara/pull/1682#discussion_r1712265094


More information about the skara-dev mailing list