Changed cron from daily to hourly (#132)
Co-authored-by: Inal Arsanukaev <inalarsanukaev@MacBook-Pro-Inal.local>
This commit is contained in:
parent
dc15f448d4
commit
7048df31bd
2
.gitignore
vendored
2
.gitignore
vendored
@ -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
|
||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>hooker</artifactId>
|
||||
<version>2.0.57-SNAPSHOT</version>
|
||||
<version>2.0.58-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>hooker</name>
|
||||
|
@ -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 " +
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ message:
|
||||
|
||||
clean:
|
||||
scheduler:
|
||||
cron: "0 0 10 * * *"
|
||||
cron: "0 0 * * * *"
|
||||
timezone: Europe/Moscow
|
||||
daysAgo: 30
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user