diff --git a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/GoodMorningNotify.java b/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/GoodMorningNotify.java deleted file mode 100644 index 52cae90..0000000 --- a/bot-context/src/main/java/dev/struchkov/bot/gitlab/context/domain/notify/GoodMorningNotify.java +++ /dev/null @@ -1,55 +0,0 @@ -package dev.struchkov.bot.gitlab.context.domain.notify; - -import dev.struchkov.bot.gitlab.context.domain.entity.MergeRequest; -import dev.struchkov.bot.gitlab.context.utils.MessageUtils; -import dev.struchkov.bot.gitlab.context.utils.Smile; -import lombok.Builder; - -import java.util.List; - -/** - * // TODO: 20.09.2020 Добавить описание. - * - * @author upagge 20.09.2020 - */ -//TODO [28.01.2022]: Решить доработать и оставить или удалить. -public record GoodMorningNotify( - List mergeRequestsReviews, - List mergeRequestsNeedWork, - String personName, String version -) implements Notify { - - @Builder - public GoodMorningNotify { - } - - @Override - public String generateMessage() { - final StringBuilder message = new StringBuilder().append(Smile.SUN).append(" *Доброе утро, ").append(personName).append("* ").append(Smile.SUN).append(Smile.TWO_BR); - if (!mergeRequestsReviews.isEmpty()) { - message.append("Необходимо проверить ").append(mergeRequestsReviews.size()).append(" ПР:").append(Smile.BR); - MessageUtils.mergeRequestForReview( - mergeRequestsReviews.stream() - .limit(3) - .toList() - ).ifPresent(message::append); - } else { - message.append("Поздравляю, у тебя ни одного ПР на проверку!"); - } - MessageUtils.mergeRequestForNeedWork( - mergeRequestsNeedWork.stream() - .limit(3) - .toList() - ).ifPresent( - messageNeedWork -> message.append(Smile.TWO_BR) - .append(Smile.DANGEROUS).append(" Требуется доработать ").append(mergeRequestsNeedWork.size()).append(" ПР:").append(Smile.BR) - .append(messageNeedWork) - ); - message - .append(Smile.TWO_BR).append("Удачного дня ").append(Smile.FLOWER) - .append(Smile.HR) - .append("_Version ").append(version).append(" | Developer @uPagge_"); - return message.toString(); - } - -} diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetMergeRequestTask.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetMergeRequestTask.java index c813f64..0d8b474 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetMergeRequestTask.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetMergeRequestTask.java @@ -5,6 +5,7 @@ import dev.struchkov.bot.gitlab.sdk.domain.MergeRequestJson; import dev.struchkov.haiti.utils.network.HttpParse; import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import java.text.MessageFormat; @@ -26,7 +27,9 @@ public class GetMergeRequestTask extends RecursiveTask> { private final String gitlabToken; @Override + @SneakyThrows protected List compute() { + Thread.sleep(100); final List mergeRequestJsons = getMergeRequestJsons(); if (mergeRequestJsons.size() == PAGE_COUNT) { final GetMergeRequestTask newTask = new GetMergeRequestTask(projectId, pageNumber + 1, urlMrOpen, gitlabToken); diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineShortTask.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineShortTask.java index 4f2fadb..da3aa40 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineShortTask.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineShortTask.java @@ -5,6 +5,7 @@ import dev.struchkov.bot.gitlab.sdk.domain.PipelineShortJson; import dev.struchkov.haiti.utils.network.HttpParse; import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import java.text.MessageFormat; @@ -28,7 +29,9 @@ public class GetPipelineShortTask extends RecursiveTask> private final String gitlabToken; @Override + @SneakyThrows protected List compute() { + Thread.sleep(100); final List jsons = getPipelineJsons(); if (jsons.size() == PAGE_COUNT) { final GetPipelineShortTask newTask = new GetPipelineShortTask(urlPipelines, projectId, pageNumber + 1, lastUpdate, gitlabToken); diff --git a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineTask.java b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineTask.java index 7c9b415..5ed72a5 100644 --- a/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineTask.java +++ b/bot-core/src/main/java/dev/struchkov/bot/gitlab/core/service/parser/forktask/GetPipelineTask.java @@ -4,6 +4,7 @@ import dev.struchkov.bot.gitlab.core.utils.StringUtils; import dev.struchkov.bot.gitlab.sdk.domain.PipelineJson; import dev.struchkov.haiti.utils.network.HttpParse; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import java.text.MessageFormat; @@ -22,7 +23,9 @@ public class GetPipelineTask extends RecursiveTask { private final String gitlabToken; @Override + @SneakyThrows protected PipelineJson compute() { + Thread.sleep(100); final PipelineJson pipelineJson = HttpParse.request( MessageFormat.format(urlPipeline, projectId, pipelineId) )