diff --git a/arex-storage-web-api/src/main/java/com/arextest/storage/repository/impl/mongo/AREXQueryMockerMongoRepositoryProvider.java b/arex-storage-web-api/src/main/java/com/arextest/storage/repository/impl/mongo/AREXQueryMockerMongoRepositoryProvider.java index 4bf4e861..e889443f 100644 --- a/arex-storage-web-api/src/main/java/com/arextest/storage/repository/impl/mongo/AREXQueryMockerMongoRepositoryProvider.java +++ b/arex-storage-web-api/src/main/java/com/arextest/storage/repository/impl/mongo/AREXQueryMockerMongoRepositoryProvider.java @@ -11,21 +11,18 @@ import com.arextest.storage.model.Constants; import com.arextest.storage.repository.ProviderNames; import com.arextest.storage.repository.RepositoryProvider; -import com.arextest.storage.utils.TimeUtils; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ArrayUtils; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.data.mongodb.core.query.Query; -import org.springframework.data.mongodb.core.query.Update; /** * The rolling provider used by default, which means auto deleted the records after TTL index @@ -83,10 +80,6 @@ public Iterable queryRecordList(MockCategoryType categoryType, public Iterable queryRecordList(MockCategoryType category, String recordId, String[] fieldNames) { Criteria criteria = buildRecordIdFilter(category, recordId); - if (Objects.equals(this.providerName, ProviderNames.DEFAULT)) { - updateExpirationTime(criteria, getCollectionName(category)); - } - Query query = new Query(criteria); if (ArrayUtils.isNotEmpty(fieldNames)) { String[] mappedFieldNames = Arrays.stream(fieldNames) @@ -101,27 +94,6 @@ public Iterable queryRecordList(MockCategoryType category, Stri return new AttachmentCategoryIterable(category, iterable); } - private void updateExpirationTime(Criteria criteria, String collectionName) { - long currentTimeMillis = System.currentTimeMillis(); - long allowedLastMills = TimeUtils.getTodayFirstMills() + - properties.getAllowReRunDays() * TimeUtils.ONE_DAY; - - Criteria finalCriteria = new Criteria().andOperator( - criteria, - new Criteria().orOperator( - Criteria.where(AbstractMocker.Fields.expirationTime).lt(new Date(allowedLastMills)), - Criteria.where(AbstractMocker.Fields.expirationTime).exists(false) - ) - ); - - // Add different minutes to avoid the same expiration time - Update update = new Update(); - update.set(AbstractMocker.Fields.expirationTime, - new Date(allowedLastMills + currentTimeMillis % TimeUtils.ONE_HOUR)); - update.set(AbstractMocker.Fields.updateTime, new Date(currentTimeMillis)); - mongoTemplate.updateMulti(new Query(finalCriteria), update, collectionName); - } - private Criteria buildRecordIdFilter(MockCategoryType categoryType, String value) { if (categoryType.isEntryPoint()) { return Criteria.where(AbstractMocker.Fields.id).is(value); diff --git a/arex-storage-web-api/src/main/resources/log4j2-dev.xml b/arex-storage-web-api/src/main/resources/log4j2-dev.xml index b5926f39..bdc8ca4e 100644 --- a/arex-storage-web-api/src/main/resources/log4j2-dev.xml +++ b/arex-storage-web-api/src/main/resources/log4j2-dev.xml @@ -26,6 +26,10 @@ + + + + diff --git a/arex-storage-web-api/src/main/resources/log4j2.xml b/arex-storage-web-api/src/main/resources/log4j2.xml index 2ff4e7d3..0524d04b 100644 --- a/arex-storage-web-api/src/main/resources/log4j2.xml +++ b/arex-storage-web-api/src/main/resources/log4j2.xml @@ -25,6 +25,10 @@ + + + + diff --git a/pom.xml b/pom.xml index fdade7a2..cab21ec3 100644 --- a/pom.xml +++ b/pom.xml @@ -433,7 +433,7 @@ - 1.3.2 + 1.3.3 3.3.2 1.8