mirror of
https://github.com/valitydev/hooker.git
synced 2024-11-06 00:05:17 +00:00
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
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
env.list
|
env.list
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>hooker</artifactId>
|
<artifactId>hooker</artifactId>
|
||||||
<version>2.0.57-SNAPSHOT</version>
|
<version>2.0.58-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>hooker</name>
|
<name>hooker</name>
|
||||||
|
@ -14,7 +14,7 @@ public class CleanTablesDao {
|
|||||||
|
|
||||||
private final NamedParameterJdbcTemplate jdbcTemplate;
|
private final NamedParameterJdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
public int cleanInvocingDaily(int daysAgo) {
|
public int cleanInvocing(int daysAgo) {
|
||||||
final String sql =
|
final String sql =
|
||||||
" with excluded_ids as (" +
|
" with excluded_ids as (" +
|
||||||
" select queue_id from hook.scheduled_task st " +
|
" select queue_id from hook.scheduled_task st " +
|
||||||
|
@ -20,7 +20,7 @@ public class CleanTablesService {
|
|||||||
@Scheduled(cron = "${clean.scheduler.cron}", zone = "${clean.scheduler.timezone}")
|
@Scheduled(cron = "${clean.scheduler.cron}", zone = "${clean.scheduler.timezone}")
|
||||||
public void loop() {
|
public void loop() {
|
||||||
log.info("Start daily cleaning of invoicing queue tables, days ago = {}", daysAgo);
|
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);
|
log.info("End daily cleaning of invoicing queue tables, rows deleted = {}", affectedRows);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ message:
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
scheduler:
|
scheduler:
|
||||||
cron: "0 0 10 * * *"
|
cron: "0 0 * * * *"
|
||||||
timezone: Europe/Moscow
|
timezone: Europe/Moscow
|
||||||
daysAgo: 30
|
daysAgo: 30
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ public class CleanTablesDaoTest extends AbstractIntegrationTest {
|
|||||||
private NamedParameterJdbcTemplate jdbcTemplate;
|
private NamedParameterJdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void cleanInvocingDaily() {
|
public void cleanInvocingTest() {
|
||||||
|
|
||||||
String sql = "with queue as ( " +
|
String sql = "with queue as ( " +
|
||||||
" insert into hook.invoicing_queue(hook_id, invoice_id, wtime) " +
|
" 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);
|
assertEquals(count, countOldRecords);
|
||||||
|
|
||||||
long newRecordsCount = jdbcTemplate.queryForObject("select count(*) from hook.invoicing_queue", new MapSqlParameterSource(), Long.class);
|
long newRecordsCount = jdbcTemplate.queryForObject("select count(*) from hook.invoicing_queue", new MapSqlParameterSource(), Long.class);
|
||||||
|
Loading…
Reference in New Issue
Block a user