Minor refactoring for AuditLogsCleanUpService and SqlPartitioningRepository
This commit is contained in:
parent
b4300b35bf
commit
d2f67d33d1
@ -18,7 +18,6 @@ package org.thingsboard.server.service.ttl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.thingsboard.server.dao.audit.AuditLogDao;
|
||||
@ -30,8 +29,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import static org.thingsboard.server.dao.model.ModelConstants.AUDIT_LOG_COLUMN_FAMILY_NAME;
|
||||
|
||||
@Service
|
||||
@ConditionalOnProperty(name = "sql.ttl.audit_logs.enabled", havingValue = "true")
|
||||
@ConditionalOnExpression("${sql.ttl.audit_logs.ttl:0} > 0")
|
||||
@ConditionalOnExpression("${sql.ttl.audit_logs.enabled:true} && ${sql.ttl.audit_logs.ttl:0} > 0")
|
||||
@Slf4j
|
||||
public class AuditLogsCleanUpService extends AbstractCleanUpService {
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ public class SqlPartitioningRepository {
|
||||
|
||||
public List<Long> fetchPartitions(String table) {
|
||||
List<Long> partitions = new ArrayList<>();
|
||||
List<String> partitionsTables = jdbcTemplate.queryForList(SELECT_PARTITIONS_STMT, new Object[]{table}, String.class);
|
||||
List<String> partitionsTables = jdbcTemplate.queryForList(SELECT_PARTITIONS_STMT, String.class, table);
|
||||
for (String partitionTableName : partitionsTables) {
|
||||
String partitionTsStr = partitionTableName.substring(table.length() + 1);
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user