mirror of
https://github.com/wassname/cachier.git
synced 2026-09-11 12:00:30 +08:00
Add prints to follow the flow in CI
This commit is contained in:
@@ -144,8 +144,9 @@ class _MongoCore(_BaseCore):
|
||||
if not entry['being_calculated']:
|
||||
return entry['value']
|
||||
|
||||
print("Got an entry. It is being calculated. Do we wait?", time_spent, self.wait_for_calc_timeout, time_spent >= self.wait_for_calc_timeout)
|
||||
if self.wait_for_calc_timeout > 0 and time_spent >= self.wait_for_calc_timeout:
|
||||
print("Got an entry. Is not valid. Force recomputation.", time_spent, self.wait_for_calc_timeout, time_spent >= self.wait_for_calc_timeout)
|
||||
print("Tired of waiting. RecalculationNeeded.", time_spent, self.wait_for_calc_timeout, time_spent >= self.wait_for_calc_timeout)
|
||||
raise RecalculationNeeded()
|
||||
|
||||
|
||||
|
||||
@@ -201,15 +201,17 @@ def test_mongo_wait_for_calc_timeout_slow():
|
||||
|
||||
thread1.start()
|
||||
thread2.start()
|
||||
sleep(1)
|
||||
res3 = _wait_for_calc_timeout_mongo_slow(1, 2)
|
||||
sleep(4)
|
||||
thread1.join()
|
||||
thread2.join()
|
||||
thread2.join()
|
||||
assert res_queue.qsize() == 2
|
||||
res1 = res_queue.get()
|
||||
res2 = res_queue.get()
|
||||
assert res1 != res2 # Timeout kicked in. Two calls were done
|
||||
res3 = _wait_for_calc_timeout_mongo_slow(1, 2)
|
||||
assert res2 == res3 or res1 == res3 # One of the cached values is returned
|
||||
res4 = _wait_for_calc_timeout_mongo_slow(1, 2)
|
||||
assert res1 == res4 or res2 == res4 or res3 == res4 # One of the cached values is returned
|
||||
|
||||
|
||||
class _BadMongoCollection:
|
||||
|
||||
Reference in New Issue
Block a user