|
|
@@ -31,6 +31,8 @@ import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.data.redis.core.BoundValueOperations;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
+import org.springframework.retry.annotation.Backoff;
|
|
|
+import org.springframework.retry.annotation.Retryable;
|
|
|
import org.springframework.scheduling.TaskScheduler;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -285,7 +287,13 @@ public class CollectionService {
|
|
|
.build());
|
|
|
}
|
|
|
|
|
|
+ @Retryable(value = {BusinessException.class}, maxAttempts = 3, backoff = @Backoff(delay = 1000))
|
|
|
public synchronized BlindBoxItem draw(Long collectionId) {
|
|
|
+// BoundValueOperations<String, Object> ops = redisTemplate.boundValueOps("draw::" + collectionId);
|
|
|
+// if (ops.get() == null) {
|
|
|
+// Boolean success = ops.setIfAbsent(blindBoxItemRepo.findByBlindBoxId(collectionId), 7, TimeUnit.DAYS);
|
|
|
+// log.info("抽盲盒缓存 {} {}", collectionId, success);
|
|
|
+// }
|
|
|
long t = System.currentTimeMillis();
|
|
|
List<BlindBoxItem> items = blindBoxItemRepo.findByBlindBoxId(collectionId);
|
|
|
|