From 7048df31bdfe655b75c8ca94583984506b2b1845 Mon Sep 17 00:00:00 2001 From: Inal Arsanukaev Date: Thu, 12 Nov 2020 17:15:26 +0300 Subject: [PATCH] Changed cron from daily to hourly (#132) Co-authored-by: Inal Arsanukaev --- .gitignore | 2 ++ pom.xml | 2 +- .../java/com/rbkmoney/hooker/dao/impl/CleanTablesDao.java | 2 +- .../java/com/rbkmoney/hooker/service/CleanTablesService.java | 2 +- src/main/resources/application.yaml | 2 +- .../java/com/rbkmoney/hooker/dao/impl/CleanTablesDaoTest.java | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index ddbf952..f177a2d 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,5 @@ fabric.properties # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* env.list + +.DS_Store diff --git a/pom.xml b/pom.xml index 205a9b9..0d2bbc3 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 hooker - 2.0.57-SNAPSHOT + 2.0.58-SNAPSHOT jar hooker diff --git a/src/main/java/com/rbkmoney/hooker/dao/impl/CleanTablesDao.java b/src/main/java/com/rbkmoney/hooker/dao/impl/CleanTablesDao.java index d824ca7..5fab5b5 100644 --- a/src/main/java/com/rbkmoney/hooker/dao/impl/CleanTablesDao.java +++ b/src/main/java/com/rbkmoney/hooker/dao/impl/CleanTablesDao.java @@ -14,7 +14,7 @@ public class CleanTablesDao { private final NamedParameterJdbcTemplate jdbcTemplate; - public int cleanInvocingDaily(int daysAgo) { + public int cleanInvocing(int daysAgo) { final String sql = " with excluded_ids as (" + " select queue_id from hook.scheduled_task st " + diff --git a/src/main/java/com/rbkmoney/hooker/service/CleanTablesService.java b/src/main/java/com/rbkmoney/hooker/service/CleanTablesService.java index ee60fae..4dd0fc8 100644 --- a/src/main/java/com/rbkmoney/hooker/service/CleanTablesService.java +++ b/src/main/java/com/rbkmoney/hooker/service/CleanTablesService.java @@ -20,7 +20,7 @@ public class CleanTablesService { @Scheduled(cron = "${clean.scheduler.cron}", zone = "${clean.scheduler.timezone}") public void loop() { log.info("Start daily cleaning of invoicing queue tables, days ago = {}", daysAgo); - int affectedRows = cleanTablesDao.cleanInvocingDaily(daysAgo); + int affectedRows = cleanTablesDao.cleanInvocing(daysAgo); log.info("End daily cleaning of invoicing queue tables, rows deleted = {}", affectedRows); } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index f6b5751..8edf8fe 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -84,7 +84,7 @@ message: clean: scheduler: - cron: "0 0 10 * * *" + cron: "0 0 * * * *" timezone: Europe/Moscow daysAgo: 30 diff --git a/src/test/java/com/rbkmoney/hooker/dao/impl/CleanTablesDaoTest.java b/src/test/java/com/rbkmoney/hooker/dao/impl/CleanTablesDaoTest.java index 062b395..572a702 100644 --- a/src/test/java/com/rbkmoney/hooker/dao/impl/CleanTablesDaoTest.java +++ b/src/test/java/com/rbkmoney/hooker/dao/impl/CleanTablesDaoTest.java @@ -19,7 +19,7 @@ public class CleanTablesDaoTest extends AbstractIntegrationTest { private NamedParameterJdbcTemplate jdbcTemplate; @Test - public void cleanInvocingDaily() { + public void cleanInvocingTest() { String sql = "with queue as ( " + " insert into hook.invoicing_queue(hook_id, invoice_id, wtime) " + @@ -41,7 +41,7 @@ public class CleanTablesDaoTest extends AbstractIntegrationTest { }); - int count = cleanTablesDao.cleanInvocingDaily(10); + int count = cleanTablesDao.cleanInvocing(10); assertEquals(count, countOldRecords); long newRecordsCount = jdbcTemplate.queryForObject("select count(*) from hook.invoicing_queue", new MapSqlParameterSource(), Long.class);