Browse Source

move SettableFuture.create() to the else block

pull/3948/head
ShvaykaD 6 years ago
committed by Andrew Shvayka
parent
commit
0a2255d055
  1. 2
      dao/src/main/java/org/thingsboard/server/dao/timeseries/CassandraBaseTimeseriesDao.java

2
dao/src/main/java/org/thingsboard/server/dao/timeseries/CassandraBaseTimeseriesDao.java

@ -405,11 +405,11 @@ public class CassandraBaseTimeseriesDao extends CassandraAbstractAsyncDao implem
} else {
CassandraPartitionCacheKey partitionSearchKey = new CassandraPartitionCacheKey(entityId, key, partition);
CompletableFuture<Boolean> hasInCacheFuture = cassandraTsPartitionsCache.has(partitionSearchKey);
SettableFuture<Void> futureResult = SettableFuture.create();
if (hasInCacheFuture == null) {
return doSavePartitionWithCache(tenantId, entityId, key, partition, partitionSearchKey, ttl);
} else {
long finalTtl = ttl;
SettableFuture<Void> futureResult = SettableFuture.create();
hasInCacheFuture.whenComplete((result, throwable) -> {
if (throwable != null) {
futureResult.setException(throwable);

Loading…
Cancel
Save