diff --git a/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java b/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java index e6d9e53..4e9f74d 100644 --- a/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java +++ b/gitlab-app/src/main/java/dev/struchkov/bot/gitlab/scheduler/SchedulerService.java @@ -32,7 +32,7 @@ public class SchedulerService { private final MergeRequestsService mergeRequestsService; private final DiscussionService discussionService; - @Scheduled(cron = "0 0 */1 * * *") + @Scheduled(cron = "${gitlab-bot.cron.scan.new-project}") public void newProjects() { log.info("Запуск процесса получение новых репозиториев c GitLab"); if (!settingService.isFirstStart()) { @@ -46,7 +46,7 @@ public class SchedulerService { log.info("Конец процесса получение новых репозиториев c GitLab"); } - @Scheduled(cron = "0 */15 * * * *") + @Scheduled(cron = "${gitlab-bot.cron.scan.new-merge-request}") public void newMergeRequests() { log.info("Запуск процесса получение новых MR c GitLab"); if (!settingService.isFirstStart()) { @@ -55,7 +55,7 @@ public class SchedulerService { log.info("Конец процесса получение новых MR c GitLab"); } - @Scheduled(cron = "0 */1 * * * *") + @Scheduled(cron = "${gitlab-bot.cron.scan.general}") public void newMergeRequest() { log.info("Запуск процесса обновления данных c GitLab"); if (!settingService.isFirstStart()) { diff --git a/gitlab-app/src/main/resources/application.yml b/gitlab-app/src/main/resources/application.yml index e5b42be..920f7c0 100644 --- a/gitlab-app/src/main/resources/application.yml +++ b/gitlab-app/src/main/resources/application.yml @@ -37,6 +37,11 @@ telegram: gitlab-bot: version: 0.0.1-SNAPSHOT + cron: + scan: + general: "0 */1 * * * *" + new-project: "0 0 */1 * * *" + new-merge-request: "0 */15 * * * *" person: telegram-id: ${TELEGRAM_PERSON_ID} token: ${GITLAB_PERSONAL_TOKEN} @@ -58,4 +63,18 @@ gitlab-bot: last-commit-of-merge-request-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1" new-note-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}" discussions-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page={3,number,#}" - discussion-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}" \ No newline at end of file + discussion-url: "${GITLAB_URL}/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}" + +--- +spring: + config: + activate: + on-profile: local + +gitlab-bot: + version: 0.0.1-SNAPSHOT + cron: + scan: + general: "0 */1 * * * *" + new-project: "0 */1 * * * *" + new-merge-request: "0 */1 * * * *" \ No newline at end of file