From b865e3e168ed8ef07bbc92e8b5789b36bdec4d37 Mon Sep 17 00:00:00 2001
From: root <root@project-endpoint.tn>
Date: Fri, 7 Mar 2025 05:55:57 +0000
Subject: [PATCH] changed prefetch test

---
 tests/weighted_friend_readonly.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/weighted_friend_readonly.py b/tests/weighted_friend_readonly.py
index dd9e55d..8bd4121 100644
--- a/tests/weighted_friend_readonly.py
+++ b/tests/weighted_friend_readonly.py
@@ -32,6 +32,7 @@ hits = []
 
 start = time.time()
 curr_user = generate_random()
+last_user = curr_user
 for i in tqdm(range(10000)):
     url = baseurl + "/user/" + curr_user
     response = requests.get(url)
@@ -39,9 +40,10 @@ for i in tqdm(range(10000)):
     times.append(content["time_ms"])
     hits.append(content["source"] == "cache")
     if fetch_friend(chance_of_selecting_friend):
-        curr_user = generate_random_friend(curr_user)
+        curr_user = generate_random_friend(last_user)
     else:
         curr_user = generate_random()
+        last_user = curr_user
 end = time.time()
 
 print_report(hits, times, end - start)
\ No newline at end of file