From 297036a5831ced51aac946e02c429115a158e089 Mon Sep 17 00:00:00 2001 From: Ahoo Wang Date: Thu, 15 Aug 2024 10:38:05 +0800 Subject: [PATCH] feat(core): Avoid time going backwards for `CacheClock` --- cosid-core/src/test/java/me/ahoo/cosid/util/CacheClockTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cosid-core/src/test/java/me/ahoo/cosid/util/CacheClockTest.java b/cosid-core/src/test/java/me/ahoo/cosid/util/CacheClockTest.java index f5dd851a7c..2cf2d0415a 100644 --- a/cosid-core/src/test/java/me/ahoo/cosid/util/CacheClockTest.java +++ b/cosid-core/src/test/java/me/ahoo/cosid/util/CacheClockTest.java @@ -54,10 +54,10 @@ void secondTimeIfBackwards() { Clock cacheClock = new Clock.CacheClock(backwardsClock); long lastTime = cacheClock.secondTime(); for (int i = 0; i < 6; i++) { + LockSupport.parkNanos(this, ONE_SECOND_PERIOD); long currentTime = cacheClock.secondTime(); assertTrue(currentTime >= lastTime); lastTime = currentTime; - LockSupport.parkNanos(this, ONE_SECOND_PERIOD); } }