Commit 6e2f1ccf57aa6869d96a32a5feca120afa576158
Merge branch 'master' of github.com:thingsboard/thingsboard
Showing
6 changed files
with
12 additions
and
0 deletions
... | ... | @@ -44,6 +44,7 @@ import java.util.Optional; |
44 | 44 | import java.util.UUID; |
45 | 45 | import java.util.concurrent.ConcurrentHashMap; |
46 | 46 | import java.util.concurrent.ConcurrentMap; |
47 | +import java.util.concurrent.TimeUnit; | |
47 | 48 | import java.util.concurrent.locks.Lock; |
48 | 49 | import java.util.concurrent.locks.ReentrantLock; |
49 | 50 | |
... | ... | @@ -148,6 +149,7 @@ public class JpaBaseEdgeEventDao extends JpaAbstractSearchTextDao<EdgeEventEntit |
148 | 149 | PreparedStatement stmt = connection.prepareStatement("call cleanup_edge_events_by_ttl(?,?)")) { |
149 | 150 | stmt.setLong(1, ttl); |
150 | 151 | stmt.setLong(2, 0); |
152 | + stmt.setQueryTimeout((int) TimeUnit.HOURS.toSeconds(1)); | |
151 | 153 | stmt.execute(); |
152 | 154 | printWarnings(stmt); |
153 | 155 | try (ResultSet resultSet = stmt.getResultSet()) { | ... | ... |
... | ... | @@ -23,6 +23,7 @@ import org.thingsboard.server.dao.util.HsqlDao; |
23 | 23 | import java.sql.Connection; |
24 | 24 | import java.sql.PreparedStatement; |
25 | 25 | import java.sql.SQLException; |
26 | +import java.util.concurrent.TimeUnit; | |
26 | 27 | |
27 | 28 | @Slf4j |
28 | 29 | @HsqlDao |
... | ... | @@ -35,6 +36,7 @@ public class HsqlEventCleanupRepository extends JpaAbstractDaoListeningExecutorS |
35 | 36 | try (Connection connection = dataSource.getConnection(); |
36 | 37 | PreparedStatement stmt = connection.prepareStatement("DELETE FROM event WHERE ts < ? AND event_type != 'DEBUG_RULE_NODE' AND event_type != 'DEBUG_RULE_CHAIN'")) { |
37 | 38 | stmt.setLong(1, otherExpirationTime); |
39 | + stmt.setQueryTimeout((int) TimeUnit.HOURS.toSeconds(1)); | |
38 | 40 | stmt.execute(); |
39 | 41 | } catch (SQLException e) { |
40 | 42 | log.error("SQLException occurred during events TTL task execution ", e); |
... | ... | @@ -43,6 +45,7 @@ public class HsqlEventCleanupRepository extends JpaAbstractDaoListeningExecutorS |
43 | 45 | try (Connection connection = dataSource.getConnection(); |
44 | 46 | PreparedStatement stmt = connection.prepareStatement("DELETE FROM event WHERE ts < ? AND (event_type = 'DEBUG_RULE_NODE' OR event_type = 'DEBUG_RULE_CHAIN')")) { |
45 | 47 | stmt.setLong(1, debugExpirationTime); |
48 | + stmt.setQueryTimeout((int) TimeUnit.HOURS.toSeconds(1)); | |
46 | 49 | stmt.execute(); |
47 | 50 | } catch (SQLException e) { |
48 | 51 | log.error("SQLException occurred during events TTL task execution ", e); | ... | ... |
... | ... | @@ -24,6 +24,7 @@ import java.sql.Connection; |
24 | 24 | import java.sql.PreparedStatement; |
25 | 25 | import java.sql.ResultSet; |
26 | 26 | import java.sql.SQLException; |
27 | +import java.util.concurrent.TimeUnit; | |
27 | 28 | |
28 | 29 | @Slf4j |
29 | 30 | @PsqlDao |
... | ... | @@ -37,6 +38,7 @@ public class PsqlEventCleanupRepository extends JpaAbstractDaoListeningExecutorS |
37 | 38 | stmt.setLong(1, otherEventsTtl); |
38 | 39 | stmt.setLong(2, debugEventsTtl); |
39 | 40 | stmt.setLong(3, 0); |
41 | + stmt.setQueryTimeout((int) TimeUnit.HOURS.toSeconds(1)); | |
40 | 42 | stmt.execute(); |
41 | 43 | printWarnings(stmt); |
42 | 44 | try (ResultSet resultSet = stmt.getResultSet()){ | ... | ... |
... | ... | @@ -74,6 +74,7 @@ public abstract class AbstractSqlTimeseriesDao extends BaseAbstractSqlTimeseries |
74 | 74 | stmt.setObject(1, ModelConstants.NULL_UUID); |
75 | 75 | stmt.setLong(2, systemTtl); |
76 | 76 | stmt.setLong(3, 0); |
77 | + stmt.setQueryTimeout((int) TimeUnit.HOURS.toSeconds(1)); | |
77 | 78 | stmt.execute(); |
78 | 79 | printWarnings(stmt); |
79 | 80 | try (ResultSet resultSet = stmt.getResultSet()) { | ... | ... |
... | ... | @@ -47,6 +47,7 @@ import java.time.format.DateTimeFormatter; |
47 | 47 | import java.util.Map; |
48 | 48 | import java.util.Optional; |
49 | 49 | import java.util.concurrent.ConcurrentHashMap; |
50 | +import java.util.concurrent.TimeUnit; | |
50 | 51 | import java.util.concurrent.locks.ReentrantLock; |
51 | 52 | |
52 | 53 | @Component |
... | ... | @@ -111,6 +112,7 @@ public class JpaPsqlTimeseriesDao extends AbstractChunkedAggregationTimeseriesDa |
111 | 112 | stmt.setString(1, partitioning); |
112 | 113 | stmt.setLong(2, systemTtl); |
113 | 114 | stmt.setLong(3, 0); |
115 | + stmt.setQueryTimeout((int) TimeUnit.HOURS.toSeconds(1)); | |
114 | 116 | stmt.execute(); |
115 | 117 | printWarnings(stmt); |
116 | 118 | try (ResultSet resultSet = stmt.getResultSet()) { | ... | ... |