Добавил sleep в задачках для ForkJoinPool
This commit is contained in:
parent
bd014f1a99
commit
dbc795a0f1
@ -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<MergeRequest> mergeRequestsReviews,
|
|
||||||
List<MergeRequest> 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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ import dev.struchkov.bot.gitlab.sdk.domain.MergeRequestJson;
|
|||||||
import dev.struchkov.haiti.utils.network.HttpParse;
|
import dev.struchkov.haiti.utils.network.HttpParse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
@ -26,7 +27,9 @@ public class GetMergeRequestTask extends RecursiveTask<List<MergeRequestJson>> {
|
|||||||
private final String gitlabToken;
|
private final String gitlabToken;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SneakyThrows
|
||||||
protected List<MergeRequestJson> compute() {
|
protected List<MergeRequestJson> compute() {
|
||||||
|
Thread.sleep(100);
|
||||||
final List<MergeRequestJson> mergeRequestJsons = getMergeRequestJsons();
|
final List<MergeRequestJson> mergeRequestJsons = getMergeRequestJsons();
|
||||||
if (mergeRequestJsons.size() == PAGE_COUNT) {
|
if (mergeRequestJsons.size() == PAGE_COUNT) {
|
||||||
final GetMergeRequestTask newTask = new GetMergeRequestTask(projectId, pageNumber + 1, urlMrOpen, gitlabToken);
|
final GetMergeRequestTask newTask = new GetMergeRequestTask(projectId, pageNumber + 1, urlMrOpen, gitlabToken);
|
||||||
|
@ -5,6 +5,7 @@ import dev.struchkov.bot.gitlab.sdk.domain.PipelineShortJson;
|
|||||||
import dev.struchkov.haiti.utils.network.HttpParse;
|
import dev.struchkov.haiti.utils.network.HttpParse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
@ -28,7 +29,9 @@ public class GetPipelineShortTask extends RecursiveTask<List<PipelineShortJson>>
|
|||||||
private final String gitlabToken;
|
private final String gitlabToken;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SneakyThrows
|
||||||
protected List<PipelineShortJson> compute() {
|
protected List<PipelineShortJson> compute() {
|
||||||
|
Thread.sleep(100);
|
||||||
final List<PipelineShortJson> jsons = getPipelineJsons();
|
final List<PipelineShortJson> jsons = getPipelineJsons();
|
||||||
if (jsons.size() == PAGE_COUNT) {
|
if (jsons.size() == PAGE_COUNT) {
|
||||||
final GetPipelineShortTask newTask = new GetPipelineShortTask(urlPipelines, projectId, pageNumber + 1, lastUpdate, gitlabToken);
|
final GetPipelineShortTask newTask = new GetPipelineShortTask(urlPipelines, projectId, pageNumber + 1, lastUpdate, gitlabToken);
|
||||||
|
@ -4,6 +4,7 @@ import dev.struchkov.bot.gitlab.core.utils.StringUtils;
|
|||||||
import dev.struchkov.bot.gitlab.sdk.domain.PipelineJson;
|
import dev.struchkov.bot.gitlab.sdk.domain.PipelineJson;
|
||||||
import dev.struchkov.haiti.utils.network.HttpParse;
|
import dev.struchkov.haiti.utils.network.HttpParse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
@ -22,7 +23,9 @@ public class GetPipelineTask extends RecursiveTask<PipelineJson> {
|
|||||||
private final String gitlabToken;
|
private final String gitlabToken;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SneakyThrows
|
||||||
protected PipelineJson compute() {
|
protected PipelineJson compute() {
|
||||||
|
Thread.sleep(100);
|
||||||
final PipelineJson pipelineJson = HttpParse.request(
|
final PipelineJson pipelineJson = HttpParse.request(
|
||||||
MessageFormat.format(urlPipeline, projectId, pipelineId)
|
MessageFormat.format(urlPipeline, projectId, pipelineId)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user