From 7d3911291d4375639caed5498bd97905cbfad29c Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 17 Dec 2024 12:06:40 +0530 Subject: [PATCH] fix: improve reliability of cache benches by introducing "fake work" --- caffeine/microbenchmarks/bench_utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/caffeine/microbenchmarks/bench_utils.py b/caffeine/microbenchmarks/bench_utils.py index 063dd9a..07ffaa2 100644 --- a/caffeine/microbenchmarks/bench_utils.py +++ b/caffeine/microbenchmarks/bench_utils.py @@ -1,16 +1,21 @@ +import time + from frappe.utils.caching import site_cache @site_cache def bench_site_cache_no_arg(): + time.sleep(0.1) return 42 @site_cache def bench_site_cache_many_args(x=4, y="abc", z=1.22): + time.sleep(0.1) return 42 @site_cache(ttl=600) def bench_site_cache_with_ttl(): + time.sleep(0.1) return 42